aspose file tools
The moose likes Swing / AWT / SWT / JFace and the fly likes adding  values to a JComboBox at runtime[urgent] Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "adding  values to a JComboBox at runtime[urgent]" Watch "adding  values to a JComboBox at runtime[urgent]" New topic
Author

adding values to a JComboBox at runtime[urgent]

netharam ram
Ranch Hand

Joined: Aug 09, 2001
Posts: 202
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

Joined: Sep 10, 2001
Posts: 72
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!
 
 
subject: adding values to a JComboBox at runtime[urgent]
 
Threads others viewed
why? this piece of code is not working
drop down menu
How to restrict data in JTextField?
how to store datecombobox in an arraylist of type combobox
Onchange JCombobox
IntelliJ Java IDE