[jdk20] RFR: 8300269: The selected item in an editable JComboBox with titled border is not visible in Aqua LAF [v2]

Phil Race prr at openjdk.org
Fri Jan 27 21:48:26 UTC 2023


On Fri, 27 Jan 2023 10:14:51 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:

>> Fixes regression bug where Aqua L&F editable JComboBox with a TitledBorder was not visible. 
>> 
>> This fix adds a conditional that addresses cases where a border is used on an AquaComboBox. The patch that caused the issue set a static height, but this height caused issues with a TitledBorder, which modifies the height to account for the border. In this case, revert to the old method of calculating a comboBox's height.
>> 
>> A point made in the previous PR was that the previous method had +1 to comboBox height. This could be re-added, but in the comment thread in [the previous PR](https://github.com/openjdk/jdk/pull/12087), leaving this out is better because the extra height causes the textField to be skewed South.
>> 
>> <img width="63" alt="Screen Shot 2023-01-20 at 12 54 47 PM" src="https://user-images.githubusercontent.com/96267980/214998560-2340ac1d-5df3-47ba-94f7-56459211330e.png">
>> 
>> This also adds the test that checks an editable JComboBox across all L&F's except GTK. There seems to be an unrelated bug to this fix that causes GTK L&F comboBoxes to not behave as expected with these key presses.
>
> Damon Nguyen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Change return to continue

This looks to me like it will need reworking in future - "22" seems a bit too much of a magic number - but reverting to using the height

src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxUI.java line 460:

> 458:         protected Rectangle rectangleForCurrentValue() {
> 459:             int width = comboBox.getWidth();
> 460:             int height = comboBox.getBorder() == null ? 22 : comboBox.getHeight();

This looks to me like it will need reworking in future - "22" seems a bit too much of a magic number - but reverting to using the height for the problem case seems safe.
However please do run all related Swing tests on Aqua INCLUDING manual tests of the combo-box - perhaps using SwingSet2 - to make sure it looks good.

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

Marked as reviewed by prr (Reviewer).

PR: https://git.openjdk.org/jdk20/pull/119



More information about the client-libs-dev mailing list