@Override
    public void paintComponent( Graphics gg ) {
    	if( labelTable != null && labelHeight == -1 ) {
    		//FIXME: labelTable only works for vertical sliders ATM
    		labelHeight = 0;
	    	for( Integer i : labelTable.keySet() ) {
	    		JComponent c = labelTable.get(i);
	    		int x = getPos( i.intValue() );
	    		int w = c.getPreferredSize().width;
	    		int h = c.getPreferredSize().height;
	    		x += (sliderWidth-w)/2;
	    		c.setBounds(x, 1, w, h);
	    		add( c );
	    		labelHeight = Math.max(labelHeight, h);
	    	}
    	}
    	
    	
    	Graphics2D g = (Graphics2D) gg;
    	int W, H;
    	if( orientation == VERTICAL ) {
    		g.translate(getWidth()/2, getHeight()/2);
    		g.rotate(-Math.PI/2);
    		g.translate(-getHeight()/2,  -getWidth()/2);
    		W = getHeight();
    		H = getWidth();
    	} else {
    		W = getWidth();
    		H = getHeight();
    	}
    	
    	if( backgroundPainter != null ) {
			backgroundPainter.paintBackground(gg,this);
		} else {
			super.paintComponent(gg);
		}
        int val = getPos(boundedRangeModel.getValue()) ;
        
        float h;
        UIUtil.setBeautifulRendering(g);
        Stroke origStroke = g.getStroke();
        GeneralPath gp = new GeneralPath();
        if( showBar ) {
	        h = labelHeight + ( H - labelHeight ) / 2.0f ;
	        g.setColor ( LINE_COLOR_1 );
	        g.setStroke( LINE_STROKE_1 );
	        gp.moveTo( sliderWidth/2, h);
	        gp.lineTo( sliderWidth/2+W-sliderWidth, h);
	        g.draw(gp);
	        g.setColor ( LINE_COLOR_2 );
	        g.setStroke( LINE_STROKE_2 );
	        gp.reset();
	        gp.moveTo( sliderWidth/2+1, h+1);
	        gp.lineTo( sliderWidth/2+W-sliderWidth, h+1);
	        g.draw(gp);
        }
		Color f = this.getForeground();
		f = new Color(f.getRed(), f.getGreen(), f.getBlue(), 200 );
		h = labelHeight + ( H - sliderHeight - labelHeight ) / 2.0f ;
		if( sliderImage == null ) {
			RoundRectangle2D roundedRectangle;
	        //drop shadow:
	        g.setStroke( SHADOW_STROKE );
	        g.setColor( SHADOW_COLOR );
	        
	        roundedRectangle = new RoundRectangle2D.Float( val - 2f, h + 2f, sliderWidth+2, sliderHeight, 6, 6 );
	        g.fill(roundedRectangle);
	        
	        g.setStroke( LINE_STROKE_2 );
	        g.setColor( f );
	        //draw the shape:
	        roundedRectangle.setRoundRect( val, h, sliderWidth, sliderHeight, 3, 3 );
	        g.fill(roundedRectangle);
			g.setColor( new Color( 255, 255, 255, 64 ) );
			//highlight the top third:
			roundedRectangle.setRoundRect( val, h, sliderWidth, ( 2 * sliderHeight ) / 3, 3, 3 );
	        g.fill(roundedRectangle);
	        //highlight the sides:
	        gp.reset();
	        gp.moveTo(val+1, h );
	        gp.lineTo(val+1, h+sliderHeight);
	        g.draw(gp);
	        gp.reset();
	        gp.moveTo(val+sliderWidth-1, h );
	        gp.lineTo(val+sliderWidth-1, h+sliderHeight);
	        g.draw(gp);
	        g.setColor( new Color(255-f.getRed(), 255-f.getGreen(), 255-f.getBlue(), 255 ) );
	        //notch in the middle:
	        gp.reset();
	        gp.moveTo(val+sliderWidth/2f, h + 2 );
	        gp.lineTo(val+sliderWidth/2f, h + sliderHeight - 2);
	        g.draw(gp);
		} else {
			g.drawImage( sliderImage.getImage(), val, (int)(h+.5), this );
		}
		
		if( orientation == VERTICAL ) {
			sliderArea.setBounds( (int)(h+.5), W - (val) - sliderWidth - 2, sliderHeight, sliderWidth+2 );
		} else {
			sliderArea.setBounds( val, (int)(h+.5), sliderWidth+2, sliderHeight );
		}

        g.setStroke(origStroke);
    }