Open kirill-grouchnikov opened 4 years ago
Found https://bugs.openjdk.java.net/browse/JDK-8180815 that says that the window scaling should work on JDK 9, but it's not working on my machine.
Changing from JFrame
to WebFrame
fixes the issue, FWIW.
I know that there are certainly some issues with scaling but unfortunately I don't have a single high-resolution screen to test any of them right now.
Also, this:
Changing from
JFrame
toWebFrame
fixes the issue, FWIW.
Is actually weird, because there should be no difference between how custom decoration is rendered on either. Unless there is some JDK issue that WebFrame
or the custom root pane component fixes unintentionally?
Overall - I'll need to take a proper look at how scaling works on different JDK and OS versions because there are certainly some differences (probably even different implementations) which also have some weird interactions with custom window decoration.
FYI you can test things on a low-resolution screen, just change Windows DPI settings to 250% and make sure all the elements are now uniformly huge. If something looks reasonably sized on a normal screen at 250%, it will look tiny on a high DPI screen. This has saved my bacon in the past, and seemed so obvious once I realized it.
I know that you can manually change OS scaling to check it on low-resolution screens - it would work for testing issues with scaling. But it's still best to test things out on an actually high-resolution screen to see if resulting UI would actually looks reasonable or not on specific resolution/scaling.
Running this on Java 9.0.4 on a Windows 10 laptop with a high-resolution screen (resolution 3480x2160, default scale of 250%) results in a really tiny, scaled down frame.
Commenting out the
JFrame.setDefaultLookAndFeelDecorated(true);
line creates a correctly sized frame. The same for commenting out theWebLookAndFeel.install();
line - which creates a decorated Metal frame.This is under the latest 1.2.12 release of WebLaf. Note that there have been changes in the later versions of the JDK / JRE for system-level scaling of content. I think that was in version 11.