How can i do a initialization for the Frame() while its getting used inside the super()? Like following in a valid way, so that the Frame and all super related has a color RED?
Note: Basically the right red box should not show because Color(r,g,b,ALPHA);

public class 999 extends Window
{
private JLabel label;
private JButton button;
private static final Canvas canvas = new Canvas();
private static final Canvas canvas0 = new Canvas();
private JLayeredPane layers;
public 999()
{
super(new Frame());
// Please make this **TRANSPARENT**
getOwner().setBackground( new Color(255, 0, 0, 0) );
layers = new JLayeredPane();
button = new JButton("close");
this.setLayout (new BorderLayout ());
button.setBackground(Color.RED);
button.setSize(200,200);
button.setLocation(0,20);
this.add("North", button);
JPanel p = new JPanel();
p.setOpaque(false); // transparent
p.setBackground( new Color(255, 0, 0, 0) ); // transparent
p.setSize(300, 200);
p.setLocation(0, 0);
p.add(new JButton("Test"));
layers.add(p, new Integer(1));
layers.setSize(400,300);
layers.setLocation(400,50);
layers.setOpaque(false); // transparent
layers.setBackground( new Color(255, 0, 0, 0) ); // transparent
this.add("North", layers);
canvas.setSize(800,800);
this.add("North",canvas);
//AWTUtilities.setWindowOpacity(this, 0.2f); // Error in Linux
}
public static void main(String[] args)
{
Window j = new 999();
j.setVisible(true);
...
}
}
This code is really odd. Create the frame elsewhere and set the values you want before you give it to this object. Or just make this call in your constructor: