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!

ComboBox#getValue() doesn't work????

bvmMay 9 2012 — edited May 9 2012
I thought the whole point of a ComboBox was to be editable (vs. a ChoiceBox, which isn't). How do you get the user's input? Sure seems like you're supposed to use getValue(): "The value of this ComboBox is defined as the selected item if the input is not editable, or if it is editable, the most recent user action: either the value input by the user, or the last selected item."

But whenever I try it, getValue() returns the last item that was selected, not anything the user has entered into the editable text field. I even tried running verbatim the "Editable Combo Boxes" example from the JavaFX site (http://docs.oracle.com/javafx/2/ui_controls/combo-box.htm), and it shows the same behavior -- the code calls getValue and gets back the last item selected, not what's currently showing in the field. Am I totally missing something, or is this a glaring bug in ComboBox?

(Using the released 2.1 on Windows XP or Windows 7.)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 6 2012
Added on May 9 2012
8 comments
1,908 views