Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use an anonymous KeyAdapter instead of implementing KeyListerner.
[graphlib_java.git] / Exemple3.java
index 2b488d1..78ccb9e 100644 (file)
@@ -1,14 +1,16 @@
 import java.util.*;
 
-public class Exemple3 {
+class Exemple3 {
 
     static final Random random = new Random();
 
     public static void main(String[] args) {
+        // Création de la fenêtre
         DrawingWindow w = new DrawingWindow("Exemple 3", 640, 480);
 
-        for (int i = 0; ; i++) {
-
+        // Sans s'arrêter, affiche des lignes au hasard avec une
+        // couleur tirée aléatoirement
+        while (true) {
             int x1 = random.nextInt(w.width);
             int y1 = random.nextInt(w.height);
             int x2 = random.nextInt(w.width);