-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP186num18.java
39 lines (33 loc) · 1 KB
/
P186num18.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.applet.Applet;
import java.awt.*;
public class P186num18 extends Applet
{
public void paint (Graphics page)
{
int size = 0;
int pos_x = 0;
int pos_y = 0;
int red = 0;
int blue = 0;
int green = 0;
setBackground (Color.BLACK);
for(int x = 0; x < 100; x++)
{
size = (int)(Math.random()*300+0);
pos_x = (int)(Math.random()*300+0);
pos_y = (int)(Math.random()*300+0);
//while(size < 300 && (pos_x < 300 && pos_y < 300))
//{
// size = (int)(Math.random()*300+0);
// pos_x = (int)(Math.random()*300+0);
// pos_y = (int)(Math.random()*300+0);
//}
//if(size > 300 && (pos_x > 0 && pos_x < 300 && pos_y > 0 && pos_y < 300))
red = (int)(Math.random()*255+0);
green = (int)(Math.random()*255+0);
blue = (int)(Math.random()*255+0);
page.setColor(new Color(red,green,blue));
page.fillOval(pos_x, pos_y, size, size);
}
}
}