views:

265

answers:

1

I'm trying to create a custom extension of BasicSliderUI. I'm just trying to make the thumb a circle (note I'm in the Windows L&F). I've created a very simple implementation that just calls g.drawOval, but whenever I drag it, it leaves a "trail" behind. Any ideas why this is?

thanks,

Jeff

+2  A: 

You need to call repaint on the whole thing, you cant just draw the oval on top of it. Swing will by default only repaint what needs to be repainted, which usually isn't the whole control. When are you drawing the circle?

Charlie
Yes, that seems to be the problem. I'm drawing it in the paint thumb method. I don't see repaint being called in, for example, the MetalSliderUI. Where does that occur?
Jeff Storey
That sounds like a very good guess.
jjnguy
Another weird thing. It seems like using g.fillOval works, but g.drawOval does not (the drawOval causes the outline to hang around).
Jeff Storey
did you make your own look and feel, make your own sliderui, or override paint() or paintComponent()?
Charlie
I just made my own SliderUI that extends BasicSliderUI
Jeff Storey