Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correct size and bbox for rectangles and circles.
[graphlib_java.git] / Exemple3.java
1 import java.util.*;
2
3 public class Exemple3 {
4
5     static final Random random = new Random();
6
7     public static void main(String[] args) {
8         DrawingWindow w = new DrawingWindow("Exemple 3", 640, 480);
9
10         for (int i = 0; ; i++) {
11
12             int x1 = random.nextInt(w.width);
13             int y1 = random.nextInt(w.height);
14             int x2 = random.nextInt(w.width);
15             int y2 = random.nextInt(w.height);
16             w.setColor(random.nextFloat(),
17                        random.nextFloat(),
18                        random.nextFloat());
19             w.drawLine(x1, y1, x2, y2);
20             w.sync();
21         }
22     }
23 }
24