Is it possible to display two set of labels with the same ticks on JSlider, one on top, one on bottom?
Asked
Active
Viewed 519 times
2
-
I can't see there any JLabel, maybe JTextField or JFormattedTextField – mKorbel May 03 '12 at 19:26
-
1Why would you want this in the first place ? Each tick only represents one value, so why would you need to labels ? Will this not simply confuse a user. I do not remember seeing sliders with two different labels for the same tick – Robin May 03 '12 at 21:32
1 Answers
1
You can implement your own SliderUI
, as shown here, and override paintTicks()
.
Alternatively, you may be trying to represent alternate units, such as Celsius v. Kelvin. You might want to consider one of these options:
Add an adjacent toggle button to switch the displayed tick units.
Add a second
JSlider
and let each one'sChangeListener
set the other's model to the equivalent setting.