-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDots.java
More file actions
35 lines (35 loc) · 720 Bytes
/
Dots.java
File metadata and controls
35 lines (35 loc) · 720 Bytes
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
package dots;
/* @author Saket*/
import java.applet.*;
import java.awt.*;
public class Dots extends Applet implements Runnable
{
Thread t;
public void init()
{
t=new Thread(this);
t.start();
}
public void run()
{
try
{
while(true)
{
repaint();
Thread.sleep(700);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void update(Graphics g)
{
Dimension d=getSize();
int x=(int)(Math.random()*d.width);
int y=(int)(Math.random()*d.height);
g.fillOval(x,y,50,50);
}
}