Special Effects and Game Development
in Java(TM) - The Applet InitBackground
import java.applet.*;
import java.awt.*;
public class initbackground extends Applet {
public void paint(Graphics g)
{
Color backgroundcolor = new Color(0,0,255);
//setColor() in the Graphics class
//sets the color of the pen
g.setColor(backgroundcolor);
//fillRect() fills a rectangular area with the
//selected color. The method requires a horizontal
//and vertival position (x and y position)
g.fillRect(0,0,200,100);
}
}
|
 |  |
|