Question

When implementing JSlider's ChangeListener, the event is fired whenever the value changes. I need to get the last value of a JSLider: I don't need every value visited by the slider, just the last value when the user releases the slider pointer.

Was it helpful?

Solution

Check getValueIsAdjusting() inside stateChanged function.

  JSlider source = (JSlider)e.getSource();
  if (!source.getValueIsAdjusting()) {
       ....
  }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top