ADDITIONAL SYSTEM INFORMATION : OS Build number: macOS 13.1 (22C65) Memory Usage: 264 MB / 12592 MB (90 MB allocated, but free) Java version: 17.0.6+10, Eclipse Adoptium, OpenJDK 64-Bit Server VM Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel Screen: Display 188945233 1920×1080 (scaling 1.00×1.00) Display 188945231 1920×1080 (scaling 1.00×1.00) Display 69733382 1680×1050 (scaling 2.00×2.00) Maximum Screen Size: 1920×1080 Best cursor sizes: 16×16→16×16, 32×32→32×32 System property file.encoding: UTF-8 System property sun.jnu.encoding: UTF-8 Locale info: en_US Numbers with default locale: 1234567890 -> 1234567890 A DESCRIPTION OF THE PROBLEM : AquaLookAndFeel does not properly move the drop-down button for JComboBox when the component orientation is changed (specifically, when the component orientation is changed from LEFT_TO_RIGHT to RIGHT_TO_LEFT). This means that text may be covered up by the drop-down button, especially if the editor component also has its component orientation updated. Downstream ticket: https://josm.openstreetmap.de/ticket/22696 MetalLaF: https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java#L183 AquaLaF: https://github.com/openjdk/jdk/blob/master/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxButton.java#L98 It looks like Aqua LaF is not handling changing component orientations for the combobox button. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Using the attached source code, toggle left-to-right using the button "Toggle LTR". EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The drop-down button for the AquaLookAndFeel behaves similarly to that for MetalLookAndFeel (as in, it moves to the left side of the combobox). ACTUAL - The drop-down button for the combobox does not move, and blocks visibility for text in the text field. ---------- BEGIN SOURCE ---------- import java.awt.ComponentOrientation; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; class Scratch { public static void main(String[] args) throws UnsupportedLookAndFeelException, ClassNotFoundException, InstantiationException, IllegalAccessException { // Note that the default LaF ("javax.swing.plaf.metal.MetalLookAndFeel") works properly UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel"); final JFrame testFrame = new JFrame(); testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JButton toggleLTR = new JButton("Toggle LTR"); final JComboBox<String> comboBox = new JComboBox<>(); final JPanel panel = new JPanel(); toggleLTR.addActionListener(l -> { if (comboBox.getComponentOrientation() == ComponentOrientation.LEFT_TO_RIGHT) { comboBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); comboBox.getEditor().getEditorComponent().setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } else { comboBox.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); comboBox.getEditor().getEditorComponent().setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); } comboBox.revalidate(); }); comboBox.addItem("92 شارع 92"); comboBox.setEditable(true); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(comboBox); panel.add(toggleLTR); testFrame.add(panel); testFrame.pack(); testFrame.setVisible(true); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Use a different LookAndFeel like Metal. FREQUENCY : always
|