Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Thursday, 6 October 2016

java applet program to print smiley..

...............STEPS TO RUN APPLET THROUGH COMMAND PROMPT

  STEP 1. open commad prompt and type "javac filename.java. "

 STEP 2. write "appletviewer   classname.java" ..............



...................................................................................................................................................................

                                           PROGRAM



import java.awt.*;
import java.applet.*;
public class smiley extends Applet
{
public void paint(Graphics g)
{
setBackground(Color.blue);
g.setColor(Color.yellow);
g.drawOval(200,200,100,100);
g.setColor(Color.yellow);
g.fillOval(200,200,100,100);
g.setColor(Color.black);
g.drawOval(220,220,20,20);
g.fillOval(220,220,20,20);
g.drawOval(260,220,20,20);
g.fillOval(260,220,20,20);
g.drawArc(220,230,60,60,180,170);
}
}
/*<applet code="smiley.java" width ="400" height="500"></applet>*/


/*........................PASTE THIS PROGRAM AS IT IS.......................*/

1 comment: