Make your own free website on Tripod.com

import java.applet.Applet;
import java.awt.*;

public class graphicsexample extends Applet
{

public void drawRoof(Graphics page)
 {page.setColor(Color.green);
  page.drawLine(200,50, 300,100);
  page.drawLine(200,50,100,100);
}

public void init()
 {resize(800,600);
}

public void paint(Graphics page)
 {
  page.setColor(Color.red);
  page.fillOval(10,10,20,30);         // start 10 over 10 down - length 20 height 30
  page.drawLine(10,10,100,100);      // connect points
  page.drawString("hello",200,200);
  page.drawRect(50,50,500,500);
  page.setColor(Color.blue);      // change color
  page.fillRect(20,20,70,70);
  drawRoof(page);               // call a function

  }
  }