JDK-8164723 : Very Small Box for JCheckBox in high DPI Monitor
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u101
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: other
  • CPU: x86
  • Submitted: 2016-08-20
  • Updated: 2016-08-24
  • Resolved: 2016-08-24
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REQUEST :
The box beside the JCheckbox is too small in high DPI devices. It is UI manager duty to figure it out and correct it.

JUSTIFICATION :
The high DIP devices are getting more and more and we need to react.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Bigger box when the DIP is high.
ACTUAL -
It is too small to be clicked or seen

CUSTOMER SUBMITTED WORKAROUND :
No proper workaround, but can be easily corrected in swing source code as follow : 

javax.swing.plaf.metal.MetalIconFactory Line 1047 -> CheckBoxIcon class getControlSize method : it returns hard coded number 13 with shoulde be as follow 

protected int getControlSize() { 
     return 13 * Toolkit.getDefaultToolkit().getScreenResolution() / 96; 
}

Because 13 is appropriate for 96 DPI

In Motif look and feel :

com.sun.java.swing.plaf.motif.MotifIconFactory : Line 94

        final static int csize = 13;

Should be changed to :

        final static int csize = 13 * Toolkit.getDefaultToolkit().getScreenResolution() / 96;

In Windows look and feel :

com.sun.java.swing.plaf.windows.WindowsIconFactory : Line 320

        final static int csize = 13;

Should be changed to :

        final static int csize = 13 * Toolkit.getDefaultToolkit().getScreenResolution() / 96;



 


Comments
The HiDPI support is implemented in JDK 9. See JDK-8055212 JEP 263: HiDPI Graphics on Windows and Linux
24-08-2016