user121196
user121196

Reputation: 31020

Java JSlider with two set of labels

Is it possible to display two set of labels with the same ticks on JSlider, one on top, one on bottom?

Upvotes: 2

Views: 539

Answers (1)

trashgod
trashgod

Reputation: 205785

You can implement your own SliderUI, as shown here, and override paintTicks().

image

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's ChangeListener set the other's model to the equivalent setting.

Upvotes: 1

Related Questions