Layerspublic class Layers extends JFrame Layers - Try to use "alpha values (transparency) to draw in layers. |
Fields Summary |
---|
int | width | int | height |
Constructors Summary |
---|
Layers(String s)
this(s, 400, 300);
| Layers(String s, int w, int h)
setTitle(s);
setSize(width=w, height=h); // a short form
setBackground(Color.black);
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
Methods Summary |
---|
public static void | main(java.lang.String[] a)
new Layers("Default Size").setVisible(true);
new Layers("Smaller", 100,100).setVisible(true);
| public void | paint(java.awt.Graphics g)
Color c1 = new Color(200,100,100, 50); // r, g, b, a
Color c2 = new Color(100,200,000,128);
Color c3 = new Color(100,200,000,255);
g.setColor(c1);
g.fillRect(0, 0, width/2, height/2);
g.setColor(c2);
g.fillRect(width/4, height/4, width/2, height/2);
g.setColor(c3);
g.fillRect(width/3, height/3, width/4, height/4);
|
|