import java.awt.*; // make of existing graphics code
import java.applet.*; // make of existing applet code
// Create an applet and draw a small circle on
// the screen.
public class Circle4 extends Applet // this is the applet
{
public void paint(Graphics g) // this does the drawing
{
g.setColor(Color.green); // set the drawing pen to green
g.fillOval(0, 0, 60, 60); // draw the top left filled circle
g.drawString("One green circle", 0, 80); // write the string
// set the drawing pen to blue
// draw the top right filled circle
// write the string
// set the drawing pen to red
// draw the bottom left filled circle
// write the string
// set the drawing pen to magenta
// draw the bottom right filled circle
// write the string
}
}
|