Draws a circle & Radius of the circle should be passed as a parameter and filled with random color using applet in JAVA.
CODING:
/*<applet code="coc" width=1000 height=510>
<param name="radius" value="500">
</applet>
*/
import java.applet.*;
import java.awt.*;
import java.util.Random;
public class coc extends Applet
{
public void paint(Graphics o)
{
Random c=new Random();
int r=c.nextInt(255),g=c.nextInt(255),b=c.nextInt(26);
int R=Integer.parseInt(getParameter("radius"));
o.setColor(new Color(r,g,b));
o.fillOval(250,10,R,R);
}
}
<param name="radius" value="500">
</applet>
*/
import java.applet.*;
import java.awt.*;
import java.util.Random;
public class coc extends Applet
{
public void paint(Graphics o)
{
Random c=new Random();
int r=c.nextInt(255),g=c.nextInt(255),b=c.nextInt(26);
int R=Integer.parseInt(getParameter("radius"));
o.setColor(new Color(r,g,b));
o.fillOval(250,10,R,R);
}
}
Comments
Post a Comment