import java.awt.*;
import javax.swing.*;
public class Applet6 extends JApplet
{
public void paint(Graphics g)
{
g.setColor(Color.black); //background
g.fillRect(1,1,500,500);
g.setColor(Color.white); //moon
g.fillOval(30,40,80,80);
// The following 8 lines did exactly what the for loop below did
// This shows how for loops can be used
// g.setColor(Color.red); //posts
// g.fillRect(90,260,20,190);
// g.setColor(Color.yellow); //lights
// g.fillOval(80,225,40,40);
// g.setColor(Color.red); //posts
// g.fillRect(390,260,20,190);
// g.setColor(Color.yellow); //lights
// g.fillOval(380,225,40,40);
for(int a=90;a<=400;a+=300)
{
g.setColor(Color.red); //posts
g.fillRect(a,260,20,190);
g.setColor(Color.yellow); //lights
g.fillOval(a-10,225,40,40);
}
// the next appllet is to draw a wall of bricks between the 2 light posts
}
}