RFR: 8140527: JInternalFrame has incorrect title button width

Alexey Ivanov aivanov at openjdk.org
Wed Jun 21 15:50:10 UTC 2023


On Tue, 20 Jun 2023 10:04:53 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> Title buttons under Widows Classic L&F got their sizes from the XP desktop theme in which button width can be bigger than height. It is construed as XP bug where sizes aren't updated properly so it uses height units for width for XP and later windows. The proposed fix uses the [same technique](https://github.com/openjdk/jdk/blob/a0595761ef35c4eec8cb84326a869b9473cd5bba/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java#L78-L82) for Classic and forces title buttons to be square and to fit the frame title in height.
> 
> Before fix SwingSet2 demo (Windows Classic InternalFrame)
> ![image](https://github.com/openjdk/jdk/assets/43534309/3d6ec539-5e17-46ce-aba5-e724af6085fe)
> 
> After fix
> ![image](https://github.com/openjdk/jdk/assets/43534309/db0135e4-d7f3-41a4-bbfa-e8e95cbd071d)

Does Windows classic theme has its own set UIManager settings?

src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java line 88:

> 86:             }
> 87:         } else {
> 88:             buttonWidth = buttonHeight;

This means line 71 can be removed because `buttonWidth` is never read from `UIManager`.

src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java line 89:

> 87:         } else {
> 88:             buttonWidth = buttonHeight;
> 89:             buttonWidth += 2;

Shouldn't the buttons be square in the classic theme?

test/jdk/javax/swing/JInternalFrame/InternalFrameTitleButtonTest.java line 105:

> 103:                         icon.getIconWidth() > height - 2) {
> 104:                         throw
> 105:                            new RuntimeException("Wrong title icon size");

Suggestion:

                        throw new RuntimeException("Wrong title icon size");

The line without wrapping is still within 80-column limit, isn't it?

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

PR Review: https://git.openjdk.org/jdk/pull/14555#pullrequestreview-1491081284
PR Review Comment: https://git.openjdk.org/jdk/pull/14555#discussion_r1237221766
PR Review Comment: https://git.openjdk.org/jdk/pull/14555#discussion_r1237202986
PR Review Comment: https://git.openjdk.org/jdk/pull/14555#discussion_r1237207281



More information about the client-libs-dev mailing list