-
Bug
-
Resolution: Fixed
-
P3
-
7
If a window was made non opaque with help of the
frame.setUndecorated(true);
AWTUtilities.setWindowOpaque(frame, false);
it is turned into the blank rectangle when glassPane is shown
frame.getGlassPane().setVisible(true);
I tested it on the latest JDK 6u11 build
GlassPane tricks are quite popular among Swing programmers
moreover this bug prevents resizing of internalFrames,
because we temporarily show the glassPane when an internalFrame is being resized
import com.sun.awt.AWTUtilities;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class GlassPanelTest {
private static void createGui() {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton button = new JButton("Show GlassPane");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.getGlassPane().setVisible(true);
}
});
frame.add(button);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setUndecorated(true);
AWTUtilities.setWindowOpaque(frame, false);
frame.setVisible(true);
}
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
GlassPanelTest.createGui();
}
});
}
}
frame.setUndecorated(true);
AWTUtilities.setWindowOpaque(frame, false);
it is turned into the blank rectangle when glassPane is shown
frame.getGlassPane().setVisible(true);
I tested it on the latest JDK 6u11 build
GlassPane tricks are quite popular among Swing programmers
moreover this bug prevents resizing of internalFrames,
because we temporarily show the glassPane when an internalFrame is being resized
import com.sun.awt.AWTUtilities;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class GlassPanelTest {
private static void createGui() {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton button = new JButton("Show GlassPane");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.getGlassPane().setVisible(true);
}
});
frame.add(button);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setUndecorated(true);
AWTUtilities.setWindowOpaque(frame, false);
frame.setVisible(true);
}
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
GlassPanelTest.createGui();
}
});
}
}
- relates to
-
JDK-6726866 Repainting artifacts when resizing or dragging JInternalFrames in non-opaque toplevel
- Resolved