• Post Reply Bookmark Topic Watch Topic
  • New Topic

adding values to a JComboBox at runtime[urgent]

 
netharam ram
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm unable to add a value to a JComboBox using the additem().I receive an error that this methos has caused an error in this Mutable_model.
Please reply as soon as possible.
Happy Middling with java.
Bye from Netharam.
 
Renee Zhang
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, netharam,
I had the same problem before. What I did is to put all data in the Vector(you may use array) and call yourCB.setModel(new DefaultComboBoxModel(YourVector));
YourCB.validate();
It works, but I think it's not a good idea because everytime one data changes, my comboBox has to changes its model. Please let me know when you have a better solution, Thanks!
Good luck!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!