-
Bug
-
Resolution: Fixed
-
P4
-
7, 8, 9
-
b16
-
x86
-
os_x
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8321508 | 17.0.11 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
JDK-8321878 | 11.0.23 | Andrew Lu | P4 | Resolved | Fixed | b01 |
Java 7 & 8, 8u5 and 8u11 recently confirmed to exhibit the issue.
ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.9.4
A DESCRIPTION OF THE PROBLEM :
The blue fuzzy border which is supposed to paint around a combo box only paints around the button part of the combo box.
Instead of the proper border around the editor, the editor highlights internally, which does not match native component behaviour.
Additionally, the height of the editor for the combo box does not match the height of the button, nor does it match the height of other text fields - all diversions from the native look of the corresponding components.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached test program.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import java.awt.FlowLayout;
public class ComboBoxPaintingTest implements Runnable {
public static void main(String[] args) {
SwingUtilities.invokeLater(new ComboBoxPaintingTest());
}
@Override
public void run() {
JLabel label = new JLabel("Editable combo box:");
// Notice that the button positioning is incorrect and that the highlighting does
// not go all the way around the combo box.
JComboBox<String> comboBox = new JComboBox<>(new String[] { "Item 1", "Item 2", "Item 3" });
comboBox.setEditable(true);
FlowLayout layout = new FlowLayout(FlowLayout.LEADING);
layout.setAlignOnBaseline(true);
JPanel panel = new JPanel(layout);
panel.add(label);
panel.add(comboBox);
JFrame frame = new JFrame();
frame.setContentPane(panel);
frame.pack();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I haven't found a workaround for the fuzzy border itself. There is a post on the Apple development list from 2009 suggesting that they might add a way to draw that border manually, but I don't think it was ever implemented.
Haqua has a workaround for the height of the text box being wrong and the kick-on issue of the baseline then being wrong. I have worked around the editable and non-editable combo boxes being the wrong size, but text fields are still slightly different to editable combo boxes.
- backported by
-
JDK-8321508 [macosx] JComboBox paints the border incorrectly
- Resolved
-
JDK-8321878 [macosx] JComboBox paints the border incorrectly
- Resolved
- duplicates
-
JDK-8268082 [macos] Editable JCombobox arrow buttons is not resized along with Textfield when font is changed
- Closed
- relates to
-
JDK-8300269 The selected item in an editable JComboBox with titled border is not visible in Aqua LAF
- Resolved
-
JDK-8294067 [macOS] javax/swing/JComboBox/6559152/bug6559152.java Cannot select an item from popup with the ENTER key.
- Resolved
-
JDK-8294254 [macOS] javax/swing/plaf/aqua/CustomComboBoxFocusTest.java failure
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/8b61278e
-
Commit openjdk/jdk17u-dev/644a4300
-
Commit openjdk/jdk/8082c24a
-
Review openjdk/jdk11u-dev/2346
-
Review openjdk/jdk17u-dev/2020
-
Review openjdk/jdk/9473