-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB.java
More file actions
90 lines (65 loc) · 1.75 KB
/
B.java
File metadata and controls
90 lines (65 loc) · 1.75 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class B extends Frame implements ActionListener, Runnable
{
Button button1;
Color clr;
int i=1,j=1;
int o=390,n=1;
Thread t;
button1 = new Button();
button1.setLabel("CLICK");
add(button1);
button1.addActionListener(this);
public void actionPerformed(ActionEvent e)
{ o=390; j=1;
if(e.getSource()==button1)
{
t=new Thread(this);
t.start();
}
}
public void run()
{
int l=40;
System.out.println("j");
i++; repaint();
Graphics page=getGraphics();
while(j<(i))
{
Random rand = new Random();
int red = rand.nextInt(255);
int green = rand.nextInt(255);
int blue = rand.nextInt(255);
clr= new Color(red,green,blue);
o=390;
while(o>=50)
{ page.setColor(clr);
page.fillOval (l*j,o, 30, 40);
page.setColor(Color.white);
System.out.println(j+" "+i);
System.out.println((l*j)+13);
page.drawLine(((l*j)+13),o+35,(l*j)+13,o+45);
try{ Thread.sleep(1000);
}
catch(Exception e){}
page.setColor(Color.black);
page.fillOval (l*j,o, 30, 40);
page.setColor(Color.black);
page.drawLine(((l*j)+13),o+35,(l*j)+13,o+45);
o-=70;
}
page.setColor(clr);
page.fillOval (l*j,o, 30, 40);
page.setColor(Color.white);
System.out.println((l*j)+13);
page.drawLine(((l*j)+13),o+35,(l*j)+13,o+45);
j++;
}
}
button1.setLocation(200, 350);
button1.setSize(60, 30);
setBackground (Color.black);
}