Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make the JPanel listen for mouse events!.
[graphlib_java.git] / Test.java
index 65a891f..d3e4e62 100644 (file)
--- a/Test.java
+++ b/Test.java
@@ -45,9 +45,16 @@ class Test{
         }
         w2.closeGraph();
 
-        while (w1.waitMousePress(5 * 1000))
-            System.out.println("[ " + w1.getMouseX() + " ; " + w1.getMouseY() +
-                               " ] -- button " + w1.getMouseButton());
+        System.out.println("Click anywhere on w1...");
+
+        while (w1.waitMousePress(5 * 1000)) {
+            int x = w1.getMouseX();
+            int y = w1.getMouseY();
+            System.out.println("[ " + x + " ; " + y + " ] - " +
+                               w1.getMouseButton());
+            w1.drawLine(x - 5, y, x + 5, y);
+            w1.drawLine(x, y - 5, x, y + 5);
+        }
 
         System.out.println("Done!");
     }