Frame()がsuper()の内部で使用されている間、初期化を行う方法はありますか?有効な方法で次のように、フレームとすべてのスーパー関連の色が赤色になるようにしますか?Frame()の内部構造をsuper()で行う方法は?
注:色(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);
...
}
}
999がクラスの有効な名前であるかどうかわかりません。私はJavaを知りません... –
[クラス名](http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1)は[idenitifier]( http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8)、「999」は有効な名前ではありません。 – trashgod
1)SwingとAWTを混在させないでください。 2)すぐにより良い助けを得るために、[SSCCE](http://pscode.org/sscce.html)を投稿してください。 –