-
Bug
-
Resolution: Duplicate
-
P4
-
9, 10
-
x86
-
other
FULL PRODUCT VERSION :
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.15063]
EXTRA RELEVANT SYSTEM CONFIGURATION :
system display scaling is set to 200%
A DESCRIPTION OF THE PROBLEM :
When attempting to set a shaped/translucent window via Frame#setBackground, HiDPI mode becomes disabled for most/all Swing component.
Frame#setOpacity appears to work correctly.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run example application listed below on a HiDPI display. Comment out #setBackground call to see expected scaling.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Swing components are scaled according to Windows settings.
ACTUAL -
Swing components are not scaled.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
public class Main {
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame("HiDPI test");
JPanel panel = new JPanel(new GridLayout(2, 0));
panel.add(new JLabel("Some text"));
panel.add(new JButton("A button"));
frame.setContentPane(panel);
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.setUndecorated(true);
frame.setBackground(new Color(0, 0, 0, .5f)); // this line disabled HiDPI
// frame.setOpacity(.5f);
frame.pack();
frame.setVisible(true);
}
}
---------- END SOURCE ----------
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.15063]
EXTRA RELEVANT SYSTEM CONFIGURATION :
system display scaling is set to 200%
A DESCRIPTION OF THE PROBLEM :
When attempting to set a shaped/translucent window via Frame#setBackground, HiDPI mode becomes disabled for most/all Swing component.
Frame#setOpacity appears to work correctly.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run example application listed below on a HiDPI display. Comment out #setBackground call to see expected scaling.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Swing components are scaled according to Windows settings.
ACTUAL -
Swing components are not scaled.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
public class Main {
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame("HiDPI test");
JPanel panel = new JPanel(new GridLayout(2, 0));
panel.add(new JLabel("Some text"));
panel.add(new JButton("A button"));
frame.setContentPane(panel);
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.setUndecorated(true);
frame.setBackground(new Color(0, 0, 0, .5f)); // this line disabled HiDPI
// frame.setOpacity(.5f);
frame.pack();
frame.setVisible(true);
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8164811 [hidpi]Tests fail with OpenGL and GDI Rendering
-
- Resolved
-