import javax.swing.JApplet;
import java.awt.Graphics;
import java.awt.Color;
public class MyHomeDemo extends JApplet
{
public void paint(Graphics g)
{
//house roof
g.setColor(Color.red);
g.fillRect(50,150,400,40);
//house
g.setColor(Color.yellow);
g.fillRect(100,190,300,310);
//house entrance doors
g.setColor(Color.white);
g.fillRect(120,230,150,270);
g.setColor(Color.green);
int xs[]={120,170,170,120,120};
int ys[]={230,250,480,500,230};
g.fillPolygon(xs,ys,5);
int xs1[]={270,220,220,270,270};
int ys1[]={230,250,480,500,230};
g.fillPolygon(xs1,ys1,5);
g.setColor(Color.black);
int x1[]={120,170,170,120,270,220,220,270,120};
int y1[]={230,250,480,500,500,480,250,230,230};
g.fillPolygon(x1,y1,9);
//house windows
g.setColor(Color.white);
g.fillRect(280,210,100,75);
g.setColor(Color.black);
g.drawRect(280,210,25,75);
g.drawRect(305,210,25,75);
g.drawRect(330,210,25,75);
g.drawRect(355,210,25,75);
//house antenna
g.drawLine(400,50,400,150);
g.drawLine(350,50,450,50);
g.drawLine(360,10,340,90);
g.drawLine(380,10,360,90);
g.drawLine(400,10,380,90);
g.drawLine(420,10,400,90);
g.drawLine(440,10,420,90);
g.drawLine(460,10,440,90);
g.drawArc(410,6,40,80,60,60);
g.drawArc(390,14,40,80,240,60);
//welcome boards
g.setColor(Color.white);
g.drawString("My Home",135,170);
g.setColor(Color.black);
g.drawString("WELCOME",135,210);
}
}
/*
<applet code='MyHomeDemo.class' width='500' height='500'></applet>
*/