aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JComboBox - Set the selection programatically at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JComboBox - Set the selection programatically at runtime" Watch "JComboBox - Set the selection programatically at runtime" New topic
Author

JComboBox - Set the selection programatically at runtime

Pradeep Kadambar
Ranch Hand

Joined: Oct 18, 2004
Posts: 148
I am using an Editable JComboBox containing predefined entries. If the user types in a new entry add it. If it is empty then show a warning that it cannot be empty and set it to the previous selected string.

I tried this in ActionListner. Every time the comboChanged event is triggered I check for emty string if not then store the selectedItem as oldString. So on comboEdited I write



Please suggest a solution :roll:
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
What's the problem ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JComboBox - Set the selection programatically at runtime