Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Editable JComboBox

843805Jan 5 2006 — edited Oct 31 2006
I have a panel with editable JComboBox's. I normally would use getSelectedItem() to get what is entered into the control. However when a user types something into the JCombBox rather than selecting an item from the list and does not hit "enter" after entering the text, the getSelectedItem() does not return what is currently entered in the field (it instead gets the last selected item). The users often do not know to hit enter when they change the value in the JComboBox so they just click an "OK" button on the panel (signifying a save) and the value in the JComboBox is not properly saved. How do I simulate an enter key in the JComboBox or get the value that has been manually entered when the user does not hot "enter" in the JComboBox. Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 28 2006
Added on Jan 5 2006
12 comments
370 views