Thursday 16 January 2014

RISING OF SUN

/*<applet code=sun2 width=700 height=500></applet>*/
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class sun2 extends Applet

{
int rad,xc,yc,ang,y1;
public void init()
{
rad=0;
ang=25;
xc=420;
yc=420;
}
public void paint(Graphics g)
{
while(ang<=360)
{
g.setColor(Color.white);
g.fillRect(0,0,700,500);
ang++;
rad=(int)(ang/3);
y1=yc-ang;
g.setColor(Color.yellow);
g.fillOval(xc,y1,rad,rad);
g.setColor(Color.blue);
g.fillRect(0,400,700,400);
for(double i=0;i<10000000;i++);
}

while(ang>=25)

{
g.setColor(Color.white);
g.fillRect(0,0,700,500);
g.setColor(Color.yellow);
ang--;
rad=(int)(ang/3);
y1=yc-ang;
g.fillOval(xc,y1,rad,rad);
g.setColor(Color.blue);
g.fillRect(0,400,700,400);
for(double i=0;i<10000000;i++);
}
}}

No comments:

Post a Comment