public ListSelectionEvent(Object source,
                          int firstIndex,
                          int lastIndex,
                          boolean isAdjusting)
Represents a change in selection status between firstIndex and lastIndex inclusive (firstIndex is less than or equal to lastIndex). At least one of the rows within the range will have changed, a good ListSelectionModel implementation will keep the range as small as possible.
Parameters:firstIndex - the first index that changed
lastIndex - the last index that changed, lastIndex >= firstIndex
isAdjusting - an indication that this is one of rapid a series of events

解决方案 »

  1.   

    这个方法的意思是这样的, 在JList中, 你在按下ctrl或者shift后,开始选择列表项,这样使用鼠标或者arrow的每次选择都会产生新的选择事件,但是一般来说只需要在ctrl或shift键释放时, 你才处理所有选中的列表条目,并不是每次改变都要处理.
        所以程序员一般在处理多项选择时都要加上:
        if(event.getValueIsAdjusting())
               //do something