RFR: 8054572: [macosx] JComboBox paints the border incorrectly [v4]

Damon Nguyen dnguyen at openjdk.org
Thu Aug 11 16:43:32 UTC 2022


On Thu, 11 Aug 2022 15:55:30 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> Damon Nguyen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Removed newline.
>
> src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxUI.java line 458:
> 
>> 456:     class AquaComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager {
>> 457:         protected Rectangle rectangleForCurrentValue() {
>> 458:             System.out.println("rectForCurrentValue NEW: " + comboBox.getHeight());
> 
> Missed removing print statement :)

Fixed. Thanks for catching that. I had a lot of comments to clean up after testing and this one slipped through.

> src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxUI.java line 460:
> 
>> 458:             System.out.println("rectForCurrentValue NEW: " + comboBox.getHeight());
>> 459:             int width = comboBox.getWidth();
>> 460:             int height = 21;
> 
> Is this a Aqua LAF constraint on max height of text-field?

This height limitation is set to match the appearance of a non-oversized font in an editable JComboBox. I tested different values, and this value matches the appearance of an editable JComboBox when the AquaLookAndFeel control font is used.

The reason for overriding this method is to set this max height and condense the logic for the editor rectangle values. Previously, this class hard coded adjustments for the width and height values of the editor rectangle in layoutContainer when editor != null. This occurs right after this rectangleForCurrentValue is called, and this method is only used to calculate the rectangle position. So, overriding this method makes more sense since it does exactly that for Aqua L&F values specifically.

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

PR: https://git.openjdk.org/jdk/pull/9473



More information about the client-libs-dev mailing list