-
Bug
-
Resolution: Fixed
-
P3
-
7u80, 8, 9, 10
-
b11
-
x86_64
-
linux_ubuntu
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8327795 | 22.0.2 | Renjith Kannath Pariyangad | P3 | Resolved | Fixed | b01 |
JDK-8327797 | 21.0.4-oracle | Renjith Kannath Pariyangad | P3 | Resolved | Fixed | b01 |
JDK-8330892 | 21.0.4 | Amos SHI | P3 | Resolved | Fixed | b01 |
JDK-8327798 | 17.0.12-oracle | Renjith Kannath Pariyangad | P3 | Resolved | Fixed | b01 |
JDK-8330885 | 17.0.12 | Amos SHI | P3 | Resolved | Fixed | b01 |
JDK-8327803 | 11.0.24-oracle | Renjith Kannath Pariyangad | P3 | Resolved | Fixed | b01 |
JDK-8331139 | 11.0.24 | Amos SHI | P3 | Resolved | Fixed | b01 |
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-8u141-b15-3~14.04-b15)
OpenJDK 64-Bit Server VM (build 25.141-b15, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux Wall-E 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The best is to check this link to understand the problem : https://stackoverflow.com/questions/46273464/background-not-refreshed-when-painting-over-a-transparent-jframe
Basically, the background of the JFrame is not refreshed despite calling repaint() when the JFrame is transparent. The bug seems to affect only the jvm for GNU/Linux as it could not be reproduced under MacOS.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
There is a test case at https://stackoverflow.com/questions/46273464/background-not-refreshed-when-painting-over-a-transparent-jframe
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The "text" label should be moving around the frame
ACTUAL -
The "text" label is painted over the frame but previously painted text are never cleared.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package test;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class TranslucentWindow extends JFrame {
/** The image we will draw on the frame **/
private final BufferedImage test = generateImage();
/** The location where to paint the image **/
private Point p = new Point();
/** Set up the GUI **/
public TranslucentWindow() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
setUndecorated(true);
setExtendedState(MAXIMIZED_BOTH);
setBackground(new Color(0, 0, 0, 0));
//Disable this line for case 2
setContentPane(new TranslucentPane());
getContentPane().addMouseMotionListener(new MouseDragListener());
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new TranslucentWindow().setVisible(true);
}
});
}
/** Move the image on the frame **/
private class MouseDragListener extends MouseAdapter {
@Override
public void mouseMoved(MouseEvent e) {
p = e.getPoint();
repaint();
}
}
/** Capture an image of any component **/
private static BufferedImage getImage(Component c) {
if(c==null) return null;
BufferedImage image = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
c.printAll(g);
g.dispose();
return image;
}
/** Generates a dummy image to be painted on the frame **/
private static BufferedImage generateImage() {
JLabel label = new JLabel("test");
label.setSize(label.getPreferredSize());
return getImage(label);
}
//Enable these lines for case 2
// @Override
// public void paint(Graphics g) {
// super.paint(g);
// g.drawImage(test, p.x, p.y, this);
// }
public class TranslucentPane extends JPanel {
public TranslucentPane() {
setOpaque(false);
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g.create();
g2d.setColor(new Color(0,0,0,0));
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.drawImage(test, p.x, p.y, this);
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Every attempt to find a workaround has failed...
- backported by
-
JDK-8327795 Background not refreshed when painting over a transparent JFrame
- Resolved
-
JDK-8327797 Background not refreshed when painting over a transparent JFrame
- Resolved
-
JDK-8327798 Background not refreshed when painting over a transparent JFrame
- Resolved
-
JDK-8327803 Background not refreshed when painting over a transparent JFrame
- Resolved
-
JDK-8330885 Background not refreshed when painting over a transparent JFrame
- Resolved
-
JDK-8330892 Background not refreshed when painting over a transparent JFrame
- Resolved
-
JDK-8331139 Background not refreshed when painting over a transparent JFrame
- Resolved
- relates to
-
JDK-8326026 Mouse drag for a transparent frame fails in Windows
- Open
-
JDK-8326027 [TEST_BUG] Comparing screenshots of frame with white background fails in Mac
- Open
- links to
-
Commit openjdk/jdk11u-dev/1ea18523
-
Commit openjdk/jdk17u-dev/94caa643
-
Commit openjdk/jdk21u-dev/d11a0654
-
Commit openjdk/jdk22u/244c1d8d
-
Commit openjdk/jdk/04d43c43
-
Review openjdk/jdk11u-dev/2646
-
Review openjdk/jdk17u-dev/2389
-
Review openjdk/jdk21u-dev/487
-
Review openjdk/jdk22u/77
-
Review openjdk/jdk/17081