any help would be appreciated greatly
this is the code i have so far:
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import java.util.Random;
public class smiley extends Applet
{
public void init() {
setBackground(Color.red);
int k;
}
public void paint( Graphics g ) {
Random wheel = new Random(149L );
int k= wheel.nextInt(11);
g.setColor(Color.blue);
g.drawOval(40+k,40+k,120,150);
g.drawOval(57+k,75+k,30,20);
g.drawOval(110+k,75+k,30,20);
g.fillOval(68+k,81+k,10,10);
g.fillOval(121+k,81+k,10,10);
g.drawOval(85+k,100+k,30,30);
g.fillArc(60+k,125+k,80,40,180,180);
g.drawOval(25+k,92+k,15,30);
g.drawOval(160+k,92+k,15,30);
g.fillArc (50+k, 40+k, 100, 55, 0, 160);
}
}
Create a separate method to paint your "smiley face" (or whatever else) to accept the position as a parameter. Then you can call it as many times as you like with random positions...
#If you have any other info about this subject , Please add it free.# |
