import java.awt.*;
import java.applet.Applet;
// Circles displays circles on the applet.
public class Circles extends Applet
{
private Circle redCircle, blueCircle;
public void init ()
{
redCircle =
new Circle (Color.red, 100, 100);
blueCircle =
new Circle (Color.blue, 200, 100);
} // method init
public void paint (Graphics g)
{
redCircle.drawCircle
(g);
blueCircle.drawCircle
(g);
} // method paint
} // class Circles
// The Circle class defines a circle and provides
// a method to draw it.
class Circle
{
private Color color;
private int x, y, diameter;
Circle (Color c, int xPosition, int yPosition)
{
color = c;
x = xPosition;
y = yPosition;
diameter = 50;
} // constructor
public void drawCircle (Graphics g)
{
g.setColor (color);
g.fillOval (x,
y, diameter, diameter);
} // method drawCircle
} // class Circle