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.