-
Bug
-
Resolution: Duplicate
-
P4
-
8u241, 11.0.9, 17.0.6
-
x86_64
-
linux_redhat_6.0
ADDITIONAL SYSTEM INFORMATION :
Reproduced in following combinations
* RHEL 8.2 + OpenJDK 1.8.0_242 and OpenJDK 11.0.9
* RHEL 8.6 + OpenJDK 17.0.5
Fault occurs on both physical hardware and VMWare Workstation Pro with 'cycle monitors' feature.
A DESCRIPTION OF THE PROBLEM :
Transparent windows implemented with Swing loose their transparency when either opened on secondary monitors or when they are dragged from primary to secondary monitor.
Investigation with xwininfo -all shows that when the window is on the primary monitor it has a bit depth of 32. When it is opened/moved to secondary monitor it switches to 24 bit depth.
Transparent windows implemented with JavaFX can be displayed without any issues on exactly the same JDK + RHEL setup.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test case on a RHEL 8.2+ environment with multiple monitors
Adjust the setLocation() call so the window appears on the secondary monitor
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Transparent window with semi-transparent red circle
ACTUAL -
Window with black background and red circle
---------- BEGIN SOURCE ----------
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class OverlayTest {
public static void main(String[] args) {
JPanel panel = new Custom();
panel.setOpaque(false);
panel.setBackground(null);
JFrame frame = new JFrame();
frame.setUndecorated(true);
frame.setBackground(new Color(0, 0, 0, 0));
frame.setTitle("TestOverlay");
frame.getContentPane().add(panel);
frame.setSize(320, 240);
frame.setResizable(false);
frame.setMinimumSize(new Dimension(1, 1));
frame.setLocation(0, 0);
frame.setVisible(true);
}
private static class Custom extends JPanel {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.clearRect(0, 0, getWidth(), getHeight());
g.setColor(new Color(255, 0, 0, 127));
g.fillOval(0, 0, getWidth(), getHeight());
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No known workaround
FREQUENCY : always
Reproduced in following combinations
* RHEL 8.2 + OpenJDK 1.8.0_242 and OpenJDK 11.0.9
* RHEL 8.6 + OpenJDK 17.0.5
Fault occurs on both physical hardware and VMWare Workstation Pro with 'cycle monitors' feature.
A DESCRIPTION OF THE PROBLEM :
Transparent windows implemented with Swing loose their transparency when either opened on secondary monitors or when they are dragged from primary to secondary monitor.
Investigation with xwininfo -all shows that when the window is on the primary monitor it has a bit depth of 32. When it is opened/moved to secondary monitor it switches to 24 bit depth.
Transparent windows implemented with JavaFX can be displayed without any issues on exactly the same JDK + RHEL setup.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test case on a RHEL 8.2+ environment with multiple monitors
Adjust the setLocation() call so the window appears on the secondary monitor
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Transparent window with semi-transparent red circle
ACTUAL -
Window with black background and red circle
---------- BEGIN SOURCE ----------
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class OverlayTest {
public static void main(String[] args) {
JPanel panel = new Custom();
panel.setOpaque(false);
panel.setBackground(null);
JFrame frame = new JFrame();
frame.setUndecorated(true);
frame.setBackground(new Color(0, 0, 0, 0));
frame.setTitle("TestOverlay");
frame.getContentPane().add(panel);
frame.setSize(320, 240);
frame.setResizable(false);
frame.setMinimumSize(new Dimension(1, 1));
frame.setLocation(0, 0);
frame.setVisible(true);
}
private static class Custom extends JPanel {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.clearRect(0, 0, getWidth(), getHeight());
g.setColor(new Color(255, 0, 0, 127));
g.fillOval(0, 0, getWidth(), getHeight());
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No known workaround
FREQUENCY : always
- duplicates
-
JDK-8006421 GraphicsConfiguration of a frame is changed when the frame is moved to another screen
- Resolved