其中有个方法:void setValueIsAdjusting(boolean b);看文档是说(一般都是针对ScrollBar)在value没有稳定下来的情况下避免监听器动作。
最后说:Sliders 和 scrollbars 经常在被拖拽的时候使用该方法。但是我看到的是如果我们在windows的一个文本窗口拖拽滑块时,文本的内容也是实时地改变的。那么是不是说明这个方法目前来说不适用了呢?
能不能举个例子,也许我理解错误。(顺便问下Sliders 和 scrollbars有什么不同,我一直都把它们当作窗口的滑动块)

解决方案 »

  1.   

    文本的内容也是实时地改变的 
    这句话应该是 窗口中显示的文本内容也是实时地改变的。也就是说其实在拖拽的时候,监听器仍然是动作的。那所谓的监听器不动作是什么意思呢?原文:
    This attribute indicates that any upcoming changes to the value of the model should be considered a single event. This attribute will be set to true at the start of a series of changes to the value, and will be set to false when the value has finished changing. Normally this allows a listener to only take action when the final value change in committed, instead of having to do updates for all intermediate values. 
    Sliders and scrollbars use this property when a drag is underway.
      

  2.   

    以上是方法void setValueIsAdjusting(boolean b);的文档。