Breaking News
Loading...
Tuesday, 9 October 2012

Java Code For Indian National Flag


package AWTP;

import java.applet.*;
import java.awt.*;
public class Flag extends Applet
{
    @Override
public void paint(Graphics g)
{
g.fillOval(60,450,120,50);
g.fillRect(110,60,10,400);
g.setColor(Color.red);
g.fillRect(120,80,150,30);
g.setColor(Color.white);
g.fillRect(120,110,150,30);
g.setColor(Color.green);
g.fillRect(120,140,150,30);
g.setColor(Color.black);
g.drawRect(120,80,150,90);
g.setColor(Color.blue);

g.drawOval(180,110,30,30);
int t=0;
int x=195,y=125;
double x1,y1;
double r=15;
double d;
for(int i=1;i<=24;i++)
{
d=(double)t*3.14/180.0;
x1=x+(double)r*Math.cos(d);
y1=y+(double)r*Math.sin(d);
g.drawLine(x,y,(int)x1,(int)y1);
t+=360/24;
}
}
}


OUTPUT :




--
/\/ir@\/  <(.'.)>

4 comments:

  1. Its not running
    .....I typed ....javac Flag .java...to compile..
    Then I typed "appletviewer Flag.java" to run ....
    The applet window is not opening

    ReplyDelete

Thanks for comment

 
Toggle Footer