Draw Over Slider


I am looking to make a rotary slider that can be moved in an x-y plane. I have overridden the drawRotarySlider() function in order to customize the look and feel of the slider, and I would also like to draw a circle in the center of the slider with which to drag it around in the x-y plane. The trouble is, the drawRotarySlider() function draws over anything I put in the paint function for the object containing my slider. What is the easiest way to change the order in which these are painted / add a circle on top of the rotary slider?


Do you expect your component to allow 2 parameters being changed at once (x&y)

If so I think it would be simpler to make the component yourself.


Not sure I understood how you want your rotary slider to look like, but in general the encouraged way to customize the look of most widgets is to write a LookAndFeel subclass which overrides the necessary methods (drawRotarySlider() in your case), then assign an instance of said LookAndFeel to the Slider whose appearance you wish to customize.