It is very common that we use JSliders in our java applications. But I want to replace JSliders by knobs. I need some guidance to study in this respect.
Asked
Active
Viewed 1,673 times
-1
-
You need to ask a more precise question. – kviiri May 17 '14 at 18:12
-
@kviiri I am using JSlider adding change listner to it for catching change events in java stand alone application. I want to replace JSlider by knob. How it can be done? – Harjit Singh May 17 '14 at 18:31
1 Answers
0
Preable: Not sure how good knobs are for the usability of the UI. I would avoid them if not for touch screen interfaces.
The is no Java support for components like Knobs so you have to create your own. Here you can find a basic example with a really simple graphic but that consist in proof of concept.
If you want to edit that code some suggestions that I give you are:
Change the
paintmethod for thepaintComponent. If you don't know why here the explanation.Use the antialiasing adding the following line of code at the beginning of the
paintComponentmethod. The picture shows you the difference.

Graphics2D g2 = (Graphics2D)g; g2.setRenderingHints( new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) );