This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JComboBox - Set the selection programatically at runtime

 
Pradeep Kadambar
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the problem ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic