JComboBox and Enter
Ivan Soleimanipour <[email protected]> Fri, 14 Dec 2007 13:58:41 -0800 (PST)
| Newsgroups | gmane.comp.java.netbeans.user-interface |
|---|---|
| Message-ID | <[email protected]> |
Editable JComboBox'es have this annoying behaviour where if it hasn't been edited and you press enter it uplevels the Enter to the dialog and closes it. This was a "good idea" requested by Jan Benway and "fixed" in 4515752. But this is problematic for me. I have a dialog which uses a JComboBox as a filter and shows the filtered items (processes for the debugger to attach to) in a table below the combobox. Enter is supposed to cause a refiltering, but doesn't sensitize the OK button. User needs to select an item before OK is sensitized. problem 1: A second enter, because of 4515752, will close the dialog even though user may have not selected an item and the Ok button is still grey. This shouldn't happen. problem 2: someone might not want to change the filter but only to refresh. One logical action is to press enter again in the combobox, but because of 4515752 the dialog closes. My first reaction was to consume the event in an ActionListener.actionPerformed() but consume is a protected member of ActionEvent. Any ideas on how to approach this?