JDK-8152980 : JTree HiDPI rendering issues in Windows look and feel
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u74
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: other
  • CPU: x86
  • Submitted: 2016-02-15
  • Updated: 2018-11-26
  • Resolved: 2016-03-30
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.10240] (Windows 10 Pro x64)

A DESCRIPTION OF THE PROBLEM :
When the Windows UI is upscaled for HiDPI screens, JTree renders in a bad way when the Windows L&F is used, cutting off text making it unreadable when large scale factors are used.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Put the example source code in a source file called TestJTree.java, compile and run the example on Windows 10 with UI scaling set to 300% (for maximum effect).

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
All components of the UI is scaled appropriately to display the scaled text.
ACTUAL -
The entries in the JTree are smaller than they would need to be to display the scaled text, leading to the text being cut off, not fully visble.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class TestJTree {
    public static void main(String[] args) throws Exception {
        javax.swing.UIManager.setLookAndFeel(
                javax.swing.UIManager.getSystemLookAndFeelClassName());

        javax.swing.JFrame frame = new javax.swing.JFrame("JTree HiDPI test");
        frame.add(new javax.swing.JTree(new String[] {
                "The quick",
                "brown fox",
                "jumps over",
                "the lazy dog",
                "Java version: " + System.getProperty("java.version"),
        }));
        frame.pack();
        frame.setVisible(true);
        frame.setDefaultCloseOperation(
                javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I have not found a workaround.


Comments
Alexandr, if it affects 9 please add Affects Version
29-03-2016

The request has been sent to the author of the issue to check the JTree behavior with the latest JDK 9 build and provide some screenshots.
29-03-2016

does it affect 9?
29-03-2016