RFR: 8300269: The selected item in an editable JComboBox with titled border is not visible in Aqua LAF [v2]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Jan 20 06:45:37 UTC 2023
On Thu, 19 Jan 2023 18:12:03 GMT, Damon Nguyen <dnguyen at 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)

=======
Without border

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
More information about the client-libs-dev
mailing list