/** Applet Using To Design House /*
package applet;
import java.awt.*;
import java.applet.*;
public class DrawingHouse extends Applet
{
public void init()
{
setSize(500,400);
}
public void paint(Graphics g)
{
setBackground(Color.red);
//Drwaw clouds
g.setColor(Color.WHITE);
g.fillOval(30, 30, 40, 40);
g.fillOval(60, 30, 40, 40);
g.fillOval(80, 30, 40, 40);
g.fillOval(40, 10, 40, 40);
g.fillOval(70, 10, 40, 40);
g.fillOval(160, 10, 20, 20);
g.fillOval(175, 10, 20, 20);
g.fillOval(190, 10, 20, 20);
g.fillOval(170, 20, 20, 20);
g.fillOval(185, 20, 20, 20);
//Draw Roof
g.setColor(Color.red);
int xs[] = {100,160,220};
int ys[] = {100,58,100};
// int[] ys = null;
Polygon poly=new Polygon(xs,ys,3);
g.fillPolygon(poly);
//For Body Of The House
g.setColor(Color.blue);
g.fillRect(100,100,120,120);
//draw the door
g.setColor(Color.white);
g.fillRect(145, 160, 30, 60);
//For Sun
g.setColor(Color.yellow);
g.fillOval(240, 30, 50, 50);
//for clouds
g.setColor(Color.white);
g.fillOval(260,50,30,30);
g.fillOval(280, 50, 30, 30);
g.fillOval(300, 50, 30, 30);
g.fillOval(270, 40, 30, 30);
g.fillOval(298, 40, 30, 30);
//draw the door
g.setColor(Color.white);
g.fillRect(145, 160, 30, 60);
//for Chimney
g.setColor(Color.black);
g.fillRect(128,55,10,30);
//door block & 2 window
g.setColor(Color.black);
g.fillRect(145, 160, 30, 60);
g.setColor(Color.magenta);
g.fillPolygon(poly);
//For Window
g.setColor(Color.white);
g.fillRect(115,125,25,25);
//cross bar window
g.setColor(Color.black);
g.drawLine(127, 125, 127, 150);
//window2
g.setColor(Color.white);
g.fillRect(180, 125, 25, 25);
//window 2 cross bar
g.setColor(Color.black);
g.drawLine(192, 125, 192, 150);
//B standard
//Draw grass
g.setColor(Color.orange);
g.fillRect(0,200,300,40);
// draw tree
g.setColor(Color.gray);
g.fillRect(28, 100, 20, 100);
g.setColor(Color.green);
g.fillOval(0,40,80,80);
// author Label1
g.setColor(Color.cyan);
g.drawString("Anuj Kumar Rey ", 280,300);
}
}
OutputScreen
package applet;
import java.awt.*;
import java.applet.*;
public class DrawingHouse extends Applet
{
public void init()
{
setSize(500,400);
}
public void paint(Graphics g)
{
setBackground(Color.red);
//Drwaw clouds
g.setColor(Color.WHITE);
g.fillOval(30, 30, 40, 40);
g.fillOval(60, 30, 40, 40);
g.fillOval(80, 30, 40, 40);
g.fillOval(40, 10, 40, 40);
g.fillOval(70, 10, 40, 40);
g.fillOval(160, 10, 20, 20);
g.fillOval(175, 10, 20, 20);
g.fillOval(190, 10, 20, 20);
g.fillOval(170, 20, 20, 20);
g.fillOval(185, 20, 20, 20);
//Draw Roof
g.setColor(Color.red);
int xs[] = {100,160,220};
int ys[] = {100,58,100};
// int[] ys = null;
Polygon poly=new Polygon(xs,ys,3);
g.fillPolygon(poly);
//For Body Of The House
g.setColor(Color.blue);
g.fillRect(100,100,120,120);
//draw the door
g.setColor(Color.white);
g.fillRect(145, 160, 30, 60);
//For Sun
g.setColor(Color.yellow);
g.fillOval(240, 30, 50, 50);
//for clouds
g.setColor(Color.white);
g.fillOval(260,50,30,30);
g.fillOval(280, 50, 30, 30);
g.fillOval(300, 50, 30, 30);
g.fillOval(270, 40, 30, 30);
g.fillOval(298, 40, 30, 30);
//draw the door
g.setColor(Color.white);
g.fillRect(145, 160, 30, 60);
//for Chimney
g.setColor(Color.black);
g.fillRect(128,55,10,30);
//door block & 2 window
g.setColor(Color.black);
g.fillRect(145, 160, 30, 60);
g.setColor(Color.magenta);
g.fillPolygon(poly);
//For Window
g.setColor(Color.white);
g.fillRect(115,125,25,25);
//cross bar window
g.setColor(Color.black);
g.drawLine(127, 125, 127, 150);
//window2
g.setColor(Color.white);
g.fillRect(180, 125, 25, 25);
//window 2 cross bar
g.setColor(Color.black);
g.drawLine(192, 125, 192, 150);
//B standard
//Draw grass
g.setColor(Color.orange);
g.fillRect(0,200,300,40);
// draw tree
g.setColor(Color.gray);
g.fillRect(28, 100, 20, 100);
g.setColor(Color.green);
g.fillOval(0,40,80,80);
// author Label1
g.setColor(Color.cyan);
g.drawString("Anuj Kumar Rey ", 280,300);
}
}
OutputScreen