-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6u10
FULL PRODUCT VERSION :
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Server VM (build 11.0-b16, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux penguin-splendor 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Video Card: nVIDIA GeForce 6150
A DESCRIPTION OF THE PROBLEM :
After turning on Compiz, when a window is created with per-pixel translucency and given a gradient background, the window turns completely transparent when placed on a white background.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Turn on Compiz fusion.
Execute the given code. Open any window with white background or change desktop background to white.
Place the translucent window from the code on top of the white Window.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A translucent window with a fully-transparent to blue gradient.
ACTUAL -
A completely transparent Window.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package demo;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.sun.awt.AWTUtilities;
import com.sun.awt.AWTUtilities.Translucency;
public class TranslucencyTest {
@SuppressWarnings("serial")
public static void main(String[] args) {
AWTUtilities.isTranslucencySupported(Translucency.PERPIXEL_TRANSLUCENT);
GraphicsConfiguration gc = findTranslucencyGC();
JFrame window = new JFrame(gc);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setUndecorated(true);
window.setSize(500, 500);
AWTUtilities.setWindowOpaque(window, false);
JPanel panel = new JPanel() {
protected void paintComponent(Graphics g) {
if (g instanceof Graphics2D) {
final int R = 50;
final int G = 50;
final int B = 200;
Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B,
0), getWidth(), getHeight(),
new Color(R, G, B, 255), true);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(p);
g2d.fillRect(0, 0, getWidth(), getHeight());
} else {
super.paintComponent(g);
}
}
};
panel.setDoubleBuffered(false);
panel.setOpaque(false);
JButton close = new JButton("Close Application");
close.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
panel.add(close);
window.getContentPane().add(panel);
window.setVisible(true);
}
private static GraphicsConfiguration findTranslucencyGC() {
GraphicsEnvironment env = GraphicsEnvironment
.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = env.getScreenDevices();
for (GraphicsDevice device : devices)
for (GraphicsConfiguration config : device.getConfigurations())
if (AWTUtilities.isTranslucencyCapable(config))
return config;
return null;
}
}
---------- END SOURCE ----------
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Server VM (build 11.0-b16, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux penguin-splendor 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
Video Card: nVIDIA GeForce 6150
A DESCRIPTION OF THE PROBLEM :
After turning on Compiz, when a window is created with per-pixel translucency and given a gradient background, the window turns completely transparent when placed on a white background.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Turn on Compiz fusion.
Execute the given code. Open any window with white background or change desktop background to white.
Place the translucent window from the code on top of the white Window.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A translucent window with a fully-transparent to blue gradient.
ACTUAL -
A completely transparent Window.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package demo;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.sun.awt.AWTUtilities;
import com.sun.awt.AWTUtilities.Translucency;
public class TranslucencyTest {
@SuppressWarnings("serial")
public static void main(String[] args) {
AWTUtilities.isTranslucencySupported(Translucency.PERPIXEL_TRANSLUCENT);
GraphicsConfiguration gc = findTranslucencyGC();
JFrame window = new JFrame(gc);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setUndecorated(true);
window.setSize(500, 500);
AWTUtilities.setWindowOpaque(window, false);
JPanel panel = new JPanel() {
protected void paintComponent(Graphics g) {
if (g instanceof Graphics2D) {
final int R = 50;
final int G = 50;
final int B = 200;
Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B,
0), getWidth(), getHeight(),
new Color(R, G, B, 255), true);
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(p);
g2d.fillRect(0, 0, getWidth(), getHeight());
} else {
super.paintComponent(g);
}
}
};
panel.setDoubleBuffered(false);
panel.setOpaque(false);
JButton close = new JButton("Close Application");
close.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
panel.add(close);
window.getContentPane().add(panel);
window.setVisible(true);
}
private static GraphicsConfiguration findTranslucencyGC() {
GraphicsEnvironment env = GraphicsEnvironment
.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = env.getScreenDevices();
for (GraphicsDevice device : devices)
for (GraphicsConfiguration config : device.getConfigurations())
if (AWTUtilities.isTranslucencyCapable(config))
return config;
return null;
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-6762511 Translucency is not working on Linux using Metacity
- Closed
- relates to
-
JDK-7167639 Per-pixel translucent windows incorrect color rendering with ATI video drivers
- Open