import java.applet.Applet; import java.awt.*; /* this applet draws a more complicated picture than does Applet 2. The new feature here is that it has some loops in the paint method*/ public class test1 extends Applet { public void init() { setBackground(Color.black); } public void paint(Graphics g) { g.setFont(new Font("Helvetica",Font.PLAIN,40)); g.setColor(Color.yellow); g.drawString("Rich: Applet 3",10,40); /**draw the triangle**/ g.setColor(Color.red); int x[]={240,240,340}; int y[]={300,400,400}; g.fillPolygon(x,y,3); /**draw the lines**/ for(int i=1;i<=10;++i) { g.setColor(Color.yellow); g.drawLine(10+20*i,60+20*i,10+20*i,400); } /**draw the circles**/ for(int i=1;i<=10;++i) { g.setColor(Color.blue); g.fillOval(20*i,50+20*i,20,20); g.fillOval(20*i,400,20,20); } } }