This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JComboBox with Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JComboBox with Vector" Watch "JComboBox with Vector" New topic
Author

JComboBox with Vector

Guy Shahar
Greenhorn

Joined: Dec 23, 2005
Posts: 22
I am trying to make a drop-down JComboBox with its options taken from a Vector. The problem is that when I add a new String to the Vector, the JComboBox becomes empty rather than displaying the updated options.

I had the same problem with a JList, but for this I was able to substitute a DefaultListModel for a Vector and it worked fine. Unfortunately, this option does not seem to be available for a JComboBox.

Can anybody help???
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
seems to work OK like this

Guy Shahar
Greenhorn

Joined: Dec 23, 2005
Posts: 22
Thanks Michael. I have messed around a bit and found a way to make it work (not sure how).
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: JComboBox with Vector
 
It's not a secret anymore!