-
Bug
-
Resolution: Not an Issue
-
P4
-
8u51
-
x86
-
os_x
FULL PRODUCT VERSION :
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OS X 10.10.5
A DESCRIPTION OF THE PROBLEM :
On OS X, an editable JComboBox with custom editor does not respond to up/down arrow keys.
If the default editor is used, the drop down list is navigable using the up / down arrow keys.
If another editor is used (e.g. javax.swing.plaf.basic.BasicComboBoxEditor) then keys are ignored.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an editable combobox with some items and set a custom combobox editor.
Run the supplied app. One combobox sets an editor the other uses the default - only the default will work.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Both comboboxes should allow selection of items with up down arrow.
ACTUAL -
The default editor will function as expected (allows selection of items with up down arrow).
The custom editor will not respond to arrows.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.ComboBoxEditor;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class ComboBoxTest
{
private static void createAndShowGUI()
{
JPanel panel = new JPanel();
// create an editable JComboBox with a ComboBoxEditor
JComboBox cb1 = new JComboBox();
cb1.setEditable(true);
ComboBoxEditor cbe1 = new javax.swing.plaf.basic.BasicComboBoxEditor();
System.out.println("No arrow selection combo: ComboBoxEditor == " + cbe1);
cb1.setEditor(cbe1);
cb1.addItem("test1");
cb1.addItem("test2");
cb1.addItem("test3");
panel.add(new JLabel("No arrow selection combo:"));
panel.add(cb1);
// create an editable JComboBox using default ComboBoxEditor
JComboBox cb2 = new JComboBox();
cb2.setEditable(true);
ComboBoxEditor cbe2 = cb2.getEditor();
System.out.println("Arrow selection works: ComboBoxEditor == " + cbe2);
//cb2.setEditor(cbe2);
cb2.addItem("test1");
cb2.addItem("test2");
cb2.addItem("test3");
panel.add(new JLabel("Arrow selection works:"));
panel.add(cb2);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
createAndShowGUI();
}
});
}
}
---------- END SOURCE ----------
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OS X 10.10.5
A DESCRIPTION OF THE PROBLEM :
On OS X, an editable JComboBox with custom editor does not respond to up/down arrow keys.
If the default editor is used, the drop down list is navigable using the up / down arrow keys.
If another editor is used (e.g. javax.swing.plaf.basic.BasicComboBoxEditor) then keys are ignored.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an editable combobox with some items and set a custom combobox editor.
Run the supplied app. One combobox sets an editor the other uses the default - only the default will work.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Both comboboxes should allow selection of items with up down arrow.
ACTUAL -
The default editor will function as expected (allows selection of items with up down arrow).
The custom editor will not respond to arrows.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.ComboBoxEditor;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class ComboBoxTest
{
private static void createAndShowGUI()
{
JPanel panel = new JPanel();
// create an editable JComboBox with a ComboBoxEditor
JComboBox cb1 = new JComboBox();
cb1.setEditable(true);
ComboBoxEditor cbe1 = new javax.swing.plaf.basic.BasicComboBoxEditor();
System.out.println("No arrow selection combo: ComboBoxEditor == " + cbe1);
cb1.setEditor(cbe1);
cb1.addItem("test1");
cb1.addItem("test2");
cb1.addItem("test3");
panel.add(new JLabel("No arrow selection combo:"));
panel.add(cb1);
// create an editable JComboBox using default ComboBoxEditor
JComboBox cb2 = new JComboBox();
cb2.setEditable(true);
ComboBoxEditor cbe2 = cb2.getEditor();
System.out.println("Arrow selection works: ComboBoxEditor == " + cbe2);
//cb2.setEditor(cbe2);
cb2.addItem("test1");
cb2.addItem("test2");
cb2.addItem("test3");
panel.add(new JLabel("Arrow selection works:"));
panel.add(cb2);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
createAndShowGUI();
}
});
}
}
---------- END SOURCE ----------