-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
7
-
None
-
generic
-
generic
Run the following test on Windows (XP and Vista tested) with the latest JDK 7 (~b65 or so) passing the -Dsun.java2d.noddraw=true command line option.
*************************************************************
import javax.swing.*;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import java.awt.*;
public class Test3 {
private static void createGui() {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
final JCheckBox cb = new JCheckBox("Set translucent background");
cb.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (cb.isSelected()) {
frame.setBackground(new Color(100, 100, 100, 100));
} else {
frame.setBackground(Color.GREEN);
}
}
});
cb.setOpaque(false);
frame.add(cb);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Test3.createGui();
}
});
}
}
*************************************************************
Observe that the first two clicks on the checkbox work as expected: the window goes to non-opaque mode and then returns to opaque mode. The third click, however, hangs Java so that even the Ctrl-C pressed in the console window does not terminate the process. The Task Manager must be used to terminate it.
This is not reproducible when the noddraw command line option is not present on the command line.
*************************************************************
import javax.swing.*;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import java.awt.*;
public class Test3 {
private static void createGui() {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
final JCheckBox cb = new JCheckBox("Set translucent background");
cb.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (cb.isSelected()) {
frame.setBackground(new Color(100, 100, 100, 100));
} else {
frame.setBackground(Color.GREEN);
}
}
});
cb.setOpaque(false);
frame.add(cb);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Test3.createGui();
}
});
}
}
*************************************************************
Observe that the first two clicks on the checkbox work as expected: the window goes to non-opaque mode and then returns to opaque mode. The third click, however, hangs Java so that even the Ctrl-C pressed in the console window does not terminate the process. The Task Manager must be used to terminate it.
This is not reproducible when the noddraw command line option is not present on the command line.