RFR: 8279614: The left line of the TitledBorder is not painted on 150 scale factor [v7]

Eirik Bakke ebakke at ultorg.com
Wed Mar 30 19:22:33 UTC 2022


> In fact, Windows 10 renders titled border flat: one grey line instead of etched border that was used in previous versions. Shall we update Swing's Windows L&F?

In the Windows L&F, the following borders all display badly on 150% HiDPI scaling, and would benefit from a fix:

TextField.border, PasswordField.border, FormattedTextField.border, ScrollPane.border, PopupMenu.border, Menu.border, ToolTip.border, as well as the borders for JSpinner and JComboBox.

I once did some work to fix these 150% HiDPI scaling border issues on the NetBeans IDE; see https://github.com/apache/netbeans/pull/1777 and https://github.com/apache/netbeans/pull/2965 and https://github.com/apache/netbeans/blob/master/platform/o.n.swing.plaf/src/org/netbeans/swing/plaf/windows8/Windows8LFCustoms.java

The issue https://bugs.openjdk.java.net/browse/JDK-8241561 is also similar.

Just passing by... thanks for your work on maintaining Swing!

-- Eirik Bakke
(Committer on the Apache NetBeans project.)

-----Original Message-----
From: client-libs-dev <client-libs-dev-retn at openjdk.java.net> On Behalf Of Alexey Ivanov
Sent: Wednesday, March 30, 2022 2:18 PM
To: client-libs-dev at openjdk.java.net
Subject: Re: RFR: 8279614: The left line of the TitledBorder is not painted on 150 scale factor [v7]

On Wed, 30 Mar 2022 16:59:50 GMT, Phil Race <prr at openjdk.org> wrote:

> Well the test is setting the Windows L&F, and evaluating its rendering. Which seems to me to make it windows-specific, as written. The test would would need to run through all the L&Fs if it is actually valid to do so.

Right, the bug was reported on Windows. The Windows L&F uses `EtchedBorder` for `TitledBorder` whereas other L&F don't. From this point of view, the bug is Windows-specific.

Yet the fix is in the shared code, in the `javax.swing.border.EtchedBorder` class which is not Look-and-Feel specific. I'm sure the problem can be reproduced if `EtchedBorder` is used directly rather than via `TitledBorder`. Yet you wouldn't see the bug on Linux and macOS because these two platforms support only integer scales, but the issue occurs with fractional scales only.

If the test uses `EtchedBorder` directly, there'll be no need to iterate L&Fs. The test sets `EtchedBorder` border to a panel, the panel renders the border.

* In fact, Windows 10 renders titled border flat: one grey line instead of etched border that was used in previous versions. Shall we update Swing's Windows L&F?

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

PR: https://git.openjdk.java.net/jdk/pull/7449


More information about the client-libs-dev mailing list