Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4515752
Votes 3
Synopsis RFE: ENTER on non-modified editable JComboBox should go to the Default Button
Category java:classes_swing
Reported Against 1.3.1
Release Fixed 1.4.1(hopper)
State 10-Fix Delivered, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 17-OCT-2001
Description
According to the Java Look and Feel Design guidelines, Return/Enter is supposed to close a combobox list and commit any change. If the list is already closed, it would be nice if Return/Enter would active the default button on the dialog box.

This makes the most sense for a non-editable combo box. Consideration should also be given for whether this makes sense for an editable combo box (maybe the first return commits any edit, and the second one is passed to the default button/container?)
Work Around
N/A
Evaluation
Most of this has been fixed for merlin and integrated for 1.4 beta2 under bug id 4337071.

Specifically, non editable combo boxes will pass throught the ENTER key events to the default button. 

For editable combo boxes, the ENTER key is not passed to the default button since ENTER is overloaded to commit the edited change. I'll consider the request to pass the ENTER to the default button if changes have not been made in the editable text field.
 xxxxx@xxxxx  2001-10-17

The current solution that I'm investigating is to detect the enter action in the ComboBoxEditor (in JComboBox.actionPerformed() and forward a new ActionEvent to the "enterPressed" entry of the JComboBox ActionMap. So far it seems to work correctly - even then editable JComboBox is a table cell editor.

Unfortunately, the code looks like a bit of a hack since the BasicComboBoxEditor doesn't know about the JComboBox so the actionPerformed method directly executes the "enterPressed" action - something thats defined in BasicComboBoxUI.

One other approach is to register an ActionListener on the editor within BasicComboBoxUI. This seem cleaner since it's now part of the UI implementation. This is the approach that I'm going to take.

 xxxxx@xxxxx  2002-04-03
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang