Rotating Ganapati Chakra


Ganapati Chakra


1) Copy this code into a notepad and save file with name Chakra.java
2) Compile the program on command prompt: javac Chakra.java 
3) Run using Appletviewer





import java.awt.*;
import java.applet.*;
/*
<applet code=Chakra.class height=220 width=250>
</applet>
 */

public class Chakra extends Applet
 {
   public void paint(Graphics g)
   {
     g.setColor(Color.red);
     g.drawString("Applet Magic by KK",100,10); 
     int x,y,i,a,r,g1,b;
     x=y=20;
     while(true)
      {
      for(i=0,a=20;i<360;i+=45)
       {
        r=(int)(Math.random()*255);
       g1=(int)(Math.random()*255); b=(int)(Math.random()*255);
       g.setColor(new Color(r,g1,b));
       g.fillArc(x,y,200,200,i,a);
for(double j=0;j<5155555;j++); 
      }
   }
}
}

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or learn thru JavaScript Online Training in India. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai

    ReplyDelete

Thanks for visiting my Blog!

Have a Question ? Need Help in College Assignments, Need Code that is not available here? Just leave a comment & get your code instantly.

Tips to Enhance Your Blog