Blanca J. Polo
There are two kinds of Java programs, applications (also called stand-alone programs) and applets. Applets run inside a web browser.
To write applets we need to import the following:
import java.applet.*;
import java.awt.*;
Area of the screen that allows us to draw on it.
class MyDrawing extends Canvas{
public void paint (Graphics g){
g.drawRect(...
// do all the drawing for this canvas here
}
Constructor:
Color (int r, int g, int
b)
setColor method selects a color that will be used for all the subsequent drawing/coloring operations.
void setColor(Color c) //changes the current color
Java Standard Colors
black, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, yellow
Drawing Graphical Shapes need to import java.awt.Graphics