RFR: 8302558: Editable JComboBox 's popup blocks user from seeing characters in Acq look and feel [v6]

Alexander Zvegintsev azvegint at openjdk.org
Mon Mar 27 07:38:35 UTC 2023


On Fri, 17 Mar 2023 18:35:07 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

>> The issue is in Aqua L&F when an editable JComboBox with a border is used. In this case, when the comboBox is clicked for the drop-down menu to show, the drop-down menu appears at the wrong coordinates (blocking the text of the comboBox and making it unreadable).
>> 
>> This seems to have been the case for a while and a similar issue appeared recently where an editable Aqua JComboBox also had wrong positioning due to having a border.
>> 
>> This fix checks for a border and modifies the bounds to accommodate the border's size. Then the usual calculations for the comboBox popup works as expected.
>> 
>> The new headful test creates an editable comboBox with a TitledBorder and with no border. Then, it automatically clicks the comboBox to open the popup, and clicks where the position of the first selectionItem should be. Finally, it checks if the selected item is correct. This is for all L&F's and the test passes on all OS's.
>
> Damon Nguyen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update Mac test to match native

test/jdk/javax/swing/JComboBox/EditableComboBoxPopupPos.java line 78:

> 76:                     String[] comboStrings = {"One", "Two", "Three"};
> 77: 
> 78:                     cb1 = new JComboBox(comboStrings);

Could you please use diamond operator here and after on JComboBox to avoid warnings?

test/jdk/javax/swing/JComboBox/EditableComboBoxPopupPos.java line 146:

> 144:                 checkSelection(cb1Str, cb2Str, cb3Str, cb4Str);
> 145:             } finally {
> 146:                 SwingUtilities.invokeAndWait(() -> frame.dispose());

With null check it will be more robust.

test/jdk/javax/swing/JComboBox/EditableComboBoxPopupPos.java line 194:

> 192:         } else {
> 193:             robot.mouseMove(p.x + width - BUTTON_OFFSET,
> 194:                     p.y + (height / 2) + POPUP_OFFSET);

I am having a solid 10 sec delay with Motif LaF for forth ComboBox.
We are moving mouse really close to the bottom right corner, so resize mouse cursor appears `⤡`.
This somehow triggers [JDK-8299937](https://bugs.openjdk.org/browse/JDK-8299937)  behavior.

Without adding `POPUP_OFFSET` all works fine(tested on Mac and Ubuntu).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/12750#discussion_r1148840265
PR Review Comment: https://git.openjdk.org/jdk/pull/12750#discussion_r1148842212
PR Review Comment: https://git.openjdk.org/jdk/pull/12750#discussion_r1148861930



More information about the client-libs-dev mailing list