FileDocCategorySizeDatePackage
Layers.javaAPI DocExample1023Sun Feb 08 21:33:50 GMT 2004None

Layers

public class Layers extends JFrame
Layers - Try to use "alpha values (transparency) to draw in layers.
author
Ian Darwin, http://www.darwinsys.com/
version
$Id: Layers.java,v 1.5 2004/02/09 03:33:49 ian Exp $

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 voidmain(java.lang.String[] a)

		new Layers("Default Size").setVisible(true);
		new Layers("Smaller", 100,100).setVisible(true);
	
public voidpaint(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);