GlassPane not visible over JDialog
I'm trying to see the GlassPane
over JDialog
but I got nothing visible over it. W开发者_StackOverflowhy does it happen? How can I make the GlassPane
visible over the JDialog
?
Here's what I'm doing:
public class New_Window extends JDialog {
public New_Window(int Screen_Index, int Start_Panel, int Length) {
super(new Frame(Monitors.getInstance().getNextDevice()
.getDefaultConfiguration()), Title, false);
setLayout(new BorderLayout());
setGlassPane(glassPane);
getGlassPane().setVisible(true);
getContentPane().setBackground(Color.black);
JPanel Container = new JPanel(new FlowLayout(FlowLayout.CENTER, 2, 2));
Container.setOpaque(false);
getContentPane().add(Container, BorderLayout.CENTER);
[...]
}
}
Note: I'm using Java version 6 update 24. I'm using a custom GlassPane
with its opaque
value set to false
.
Read the section from the Swing tutorial on Using a Glass Pane for a working example. Start with the example code and remove code you don't need.
精彩评论