LAUGH SYMBOL
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.lang.*;
public class Example {
public static void main(String a[])
{
Ex i=new Ex();
}
}
class Ex extends Frame implements Runnable//runnable is an inteface we crate threads using thread class and Runnable interface
{
Thread t;//thread is a class
Ex()
{
this.setBackground(Color.red);//background color for frame
this.setTitle("smile icon");//title
this.setSize(600,600);//size of the frame(x,y)
this.setVisible(true);//frame visibility is true
t=new Thread(this);//thread is a class
t.start();//start() method is used for start the thread
}
public void paint(Graphics g)//pain is a method. it is used for draw the images and text
{
g.setColor(Color.yellow);//set color for smile icon oval
g.fillOval(50,50,50,50);//smile icon oval size(x,y,width,height)
g.setColor(Color.white);//set color for eyes
g.fillOval(60,64,10,10);//eye size(x,y,width,height)
g.fillOval(80,64,10,10);// " "
g.setColor(Color.black);//set color for smile icon eye
g.fillOval(63,66,4,4);//eye size(x,y,width,height)
g.fillOval(83,66,4,4);// " "
g.setColor(Color.white);//set color for smile icon laugh
g.fillOval(63,76,20,10);//eye size(x+width,y+height,width,height)
g.setColor(Color.red);
g.drawOval(63,76,20,10);
}
public void run()//run() is a method to run thread
{
}
}
OUTPUT

import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.lang.*;
public class Example {
public static void main(String a[])
{
Ex i=new Ex();
}
}
class Ex extends Frame implements Runnable//runnable is an inteface we crate threads using thread class and Runnable interface
{
Thread t;//thread is a class
Ex()
{
this.setBackground(Color.red);//background color for frame
this.setTitle("smile icon");//title
this.setSize(600,600);//size of the frame(x,y)
this.setVisible(true);//frame visibility is true
t=new Thread(this);//thread is a class
t.start();//start() method is used for start the thread
}
public void paint(Graphics g)//pain is a method. it is used for draw the images and text
{
g.setColor(Color.yellow);//set color for smile icon oval
g.fillOval(50,50,50,50);//smile icon oval size(x,y,width,height)
g.setColor(Color.white);//set color for eyes
g.fillOval(60,64,10,10);//eye size(x,y,width,height)
g.fillOval(80,64,10,10);// " "
g.setColor(Color.black);//set color for smile icon eye
g.fillOval(63,66,4,4);//eye size(x,y,width,height)
g.fillOval(83,66,4,4);// " "
g.setColor(Color.white);//set color for smile icon laugh
g.fillOval(63,76,20,10);//eye size(x+width,y+height,width,height)
g.setColor(Color.red);
g.drawOval(63,76,20,10);
}
public void run()//run() is a method to run thread
{
}
}
OUTPUT
No comments:
Post a Comment