Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what does getModel do?

 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can somebody please explain that what exactly getModel does ? really confused . It's wriiten in it's description that it returns the model that contains it? then what is this model? jList.getModel()).addElement(object);
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to Use Models
 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply and the topic was helpful but it has lead me to another problem . If i update a model and if the model has already been added to the list like this :




i am mailing the whole code now






i included the string g just for finding out where i was going wrong . Now what i want this code to do is that whenever i click ok , the value in the combobox is appended to the list and not that the last value is rplaced with it . What exactly am i doing wrong ?
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is about a JList and its model. 90% of the posted code has nothing to do with your question.

Post a SSCCE that demonstrates the problem.
 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry about that but still giving you some more details . In that code i didn't implement the ListSelectionListener interface because i am not selecting anything from the list just adding the values to the list . So on the button click the action taken by the listener should be to take the value selected in combobox and then append it at the end of the list , instead it overwrites the last value in list .
 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class ContactEditorUI
{
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic