Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use DISPOSE_ON_CLOSE for JFrame.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 14 Oct 2014 12:09:22 +0000 (14:09 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 14 Oct 2014 12:12:29 +0000 (14:12 +0200)
DrawingWindow.java
TODO
Test.java
overview.html

index 0fd0571..3b42553 100644 (file)
@@ -636,7 +636,7 @@ public class DrawingWindow {
         frame.add(panel);
         frame.pack();
         frame.setResizable(false);
-        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
         frame.addKeyListener(panel);
         frame.setLocationByPlatform(true);
         frame.setVisible(true);
diff --git a/TODO b/TODO
index d518fc7..52db38a 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
-* Add set(Bg)Color with int
 * Add waitMousePress
 * Check if drawText can be improved (alignment)
 * Add drawTextBg?
index ee95f63..74038e2 100644 (file)
--- a/Test.java
+++ b/Test.java
@@ -1,6 +1,8 @@
 class Test{
     public static void main(String[] args) {
-        DrawingWindow w = new DrawingWindow("Test!", 400, 400);
+        DrawingWindow w;
+
+        w = new DrawingWindow("Test!", 400, 400);
 
         w.setColor("lawngreen");
         for (int i = 0; i < 12; i++) {
@@ -22,5 +24,29 @@ class Test{
             w.drawTriangle(p, 125, p + i, 125 + i/2, p, 125 + i);
             w.fillTriangle(p, 150, p + i, 150 + i/2, p, 150 + i);
         }
+
+        w = new DrawingWindow("Test!", 800, 600);
+
+        w.setBgColor("red");
+        w.setColor("blue");
+        for (int i = 0; i < 10; i++) {
+            w.clearGraph();
+            for (int y = 0; y < w.height; y++) {
+                for (int x = 0; x < w.width; x++) {
+                    w.drawPoint(x, y);
+                }
+            }
+        }
+        w.setColor("white");
+        for (int i = 0; i < 10; i++) {
+            w.clearGraph();
+            for (int y = 0; y < w.height; y++) {
+                for (int x = 0; x < w.width; x++) {
+                    w.drawPoint(x, y);
+                }
+                w.sync();
+            }
+        }
+        w.closeGraph();
     }
 }
index b92eb09..89e27f4 100644 (file)
     <h2>Modifications</h2>
 
     <p><pre>
--- lun. 14 oct. 2014 13:33:48 +0200
+-- lun. 14 oct. 2014 14:09:22 +0200
 
         * Ajout des méthodes setColor(int) et setBgColor(int).
         * Liste de noms de couleurs plus complète.
+        * Ne termine l'application que lorsque la dernière fenêtre est fermée.
     </pre>
 
   </body>