开发者

JSlider last value

开发者 https://www.devze.com 2023-02-06 01:27 出处:网络
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 slide开发者_如何学编程r,

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 slide开发者_如何学编程r, just the last value when the user releases the slider pointer.


Check getValueIsAdjusting() inside stateChanged function.

  JSlider source = (JSlider)e.getSource();
  if (!source.getValueIsAdjusting()) {
       ....
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消