문제

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.

도움이 되었습니까?

해결책

Check getValueIsAdjusting() inside stateChanged function.

  JSlider source = (JSlider)e.getSource();
  if (!source.getValueIsAdjusting()) {
       ....
  }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top