• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

what does getModel do?

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
Rancher
Posts: 3287
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to Use Models
 
budsy remo
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 3287
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
class ContactEditorUI
{
 
Do not threaten THIS beaver! Not even with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic