On Thu, 19 Jan 2023 18:12:03 GMT, Damon Nguyen <dngu...@openjdk.org> wrote:

>> The fixed height causes the titled border insets to reserve a majority of 
>> the height available for the component. This fixed height is meant for the 
>> default AquaComboBox usage, so the old default height is more applicable 
>> when a border, such as TitledBorder, is set on an Aqua Editable ComboBox.
>> 
>> A conditional to check for a border is added since this is the default for 
>> an AquaComboBox using AquaBorder in AquaComboBoxUI's 
>> rectangleForCurrentValue() step. A check for any border rather than an 
>> instance of a TitledBorder is used because this issue causes changes in 
>> other borders as well (I found it for LineBorder for example). 
>> 
>> The editable JComboBox is visible with a LineBorder, but the coordinates of 
>> the comboBox are aligned with the top of the arrowButton instead of the 
>> bottom (which was the case before the previous fix). So, the method now 
>> defaults to the behavior before the fix for any editable comboBox pre-fix if 
>> a different border is set.
>
> Damon Nguyen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Add test

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();

Before JDK-8054572, comboBox.getHeight()+1 was used , shouldn't we use the same 
if we are going to fallback to previous way with border

`editorRect.height += 1;`

Also, it seems for TitledBorder the popupmenu is not aligned properly. It 
should have been at the base of the combobox, just as it is for without 
border...although I don think it's related to this fix but seems to be a bug 
nevertheless (in Date/Time macos settings, popupmenu for editable combobox is 
at the base)

![image](https://user-images.githubusercontent.com/43534309/213630526-9cdc5401-d975-4bc3-9cd8-db3a01057d47.png)

=======
Without border

![image](https://user-images.githubusercontent.com/43534309/213632563-6df07625-22f6-4630-9d3b-511b5ff3cadd.png)

test/jdk/javax/swing/JComboBox/JComboBoxWithTitledBorderTest.java line 168:

> 166:         try {
> 167:             final Rectangle screenBounds = new Rectangle(0, 0,
> 168:                     1280, 720);

Probably better to use Toolkit.getScreenSize() for this

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

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

Reply via email to