Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ListDataEvent ...looks Stange...?

 
Bhagya Tangutur
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have DefaultList Model which holds data.I am listening to this Model.When i get ListDataEvent.I got methods like getIndex0(),getIndex1() methods which barely says range of indices changed/removed/added.It Is easy to get Objects when there is change of existing Objects or new one added.Is there any work around you think to get what objects are removed from the Model.

Ex:

ListDataListener listner1=new ListdataListener(){

public void intervalAdded(ListDataEvent e){
}
public void intervalRemoved(ListDataEvent e){

}
public void contentsChanged(ListDataEvent e){
}
}
DefaultListModel model=new DefaultListModel();
model.addListDataListnere(listener1);
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No... the event is thrown after the data has already been removed from the model, so you can't get them from the model anymore...

If the data is held somewhere else other than the list model, you could iterate through the model and see if there are any extra data values, and you know those are removed...
 
Bhagya Tangutur
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's true...Thanks for your time to clarify me.with your answer i am clear that what am i expected is right.
[ December 24, 2002: Message edited by: Kumar T ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic