java

Document Sample
java Powered By Docstoc
					//Program No. 15(B)
/**To display a house using graphics*/
import java.awt.*;
import java.applet.*;
/*
<applet code="MyApplet2" width=500 height=80>
</applet>
*/
public class MyApplet2 extends Applet
{
Font f;
String msg;
public void init()
{
f=new Font("GRAPHIC HOUSE",Font.BOLD,25);
msg="GRAPHIC HOUSE";
setFont(f);
}
public void start()
{
//starts or resumes execution
}
public void stop()
{
//suspends execution
}
public void destroy()
{
//performs shutdown activities
}
public void paint(Graphics g)
{
setBackground(Color.cyan);
g.drawString(msg,600,200);
g.drawRect(600,400,200,150);
g.drawLine(580,420,700,300);
g.drawLine(820,420,700,300);
g.drawRect(620,420,25,50);
g.drawRect(760,420,25,50);
g.drawRect(675,450,50,100);
g.fillOval(680,350,40,40);

}
}
/*
SAMPLE OUTPUT:
D:\java files>javac MyApplet2.java
D:\java files>AppletViewer MyApplet2.java
*/

				
DOCUMENT INFO
Shared By:
Tags:
Stats:
views:12
posted:6/26/2012
language:Latin
pages:2