Java Code

import java.awt.*;
import javax.swing.*;
public class House extends JApplet
{
  public void paint (Graphics g )
  {
     g.setColor( Color.pink );
     g.fillRect ( 100,100,200,200 );
     g.setColor( Color.black );
     Polygon poly = new Polygon( );
     poly.addPoint(100,100);
     poly.addPoint(200,50);
     poly.addPoint(300,100);
     g.fillPolygon(poly);

     g.setColor( Color.blue );
     g.fillRect ( 200,230,40,70);
     g.fillRect ( 120,150,20,30);
     g.fillRect ( 150,150,20,30);
     g.fillRect ( 200,150,20,30);
     g.fillRect ( 230,150,20,30);
     g.setColor( Color.black );
     g.fillRect ( 400,130,30,170 );
     g.setColor( Color.green );
     g.fillOval( 370,80,100,100 );
     g.fillRect ( 0,295,500,5 );
  }
}

Back to Code Examples
©2006- by E.S.Boese. All Rights Reserved