Search This Blog

Friday, November 19, 2010

Express yourself with emoticons in Applet














import javax.swing.*;
import java.awt.*;

public class Emoticon extends JApplet
{
/*<applet code="Emoticon.class" height=250 width=250>
   </applet>
*/
  JLabel lbl;


public void paint(Graphics g)
  {
        g.setColor(Color.orange);
        g.fillOval(10,10,200,200);
        g.setColor(Color.red);
       // g.fillOval(20,40,40,40); //For Round Left Eye
       // g.fillOval(160,40,40,40);//For Round Right Eye
        g.fillOval(40,40,60,40);   //For Oval Left Eye
        g.fillOval(120,40,60,40);  //For Oval Right Eye
        g.drawLine(110,80,110,140);
        g.drawArc(40,60,140,110,230,80);
        g.drawLine(60,162,70,152);
        g.drawLine(150,152,160,162);
        g.setFont(new Font("Helvetica", Font.BOLD, 18));
        g.drawString("Welcome to My Blog!",10,230);
    
    }

}

0 comments:

Post a Comment