How exactly do I use the "fireContentsChanged" method in java.swing.AbstractListModel? -


how use firecontentschanged() method in java.swing.abstractlistmodel? method called when of listmodel's elements have "contents" changed.

  1. does mean index's object has changed somehow?
  2. or include when index's object has been replaced different object?
  3. can use added/removed indexes? example, let's remove 10 random elements anywhere in list. index0 , index1 give? if insert 10 elements in random places?

abstractlistmodel abstract implementation of listmodel provides concrete implementations of listdatalistener methods, contains no specific data structure internally. receipt of corresponding listdataevent allows listening jlist update in response change in listmodel. defaultlistmodel typical concrete subclass of abstractlistmodel manipulate vector internally. source illustrates typical usage. in particular, firecontentschanged() "sent when contents of list has changed in way that's complex characterize previous methods," fireintervaladded() or fireintervalremoved(). because vector legacy of original defaulttablemodel, you'll want use more flexible alternative; index0 , index1 refer elements of chosen data structure.

what if insert 10 elements in random places?

then index0 , index1 should "bracket change."

what "bracket change" mean?

in context, bracket used verb meaning enclose or include; index0 should include lowest changed index, , index1 should include highest changed index. range may include intervening cells, though not changed. happily, jtable, jlist renders visible cells, marginal cost bounded; more here.


Comments