Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use an anonymous KeyAdapter instead of implementing KeyListerner.
[graphlib_java.git] / Test.java
1 class Test{
2     public static void main(String[] args) {
3         DrawingWindow w;
4
5         w = new DrawingWindow("Test!", 400, 400);
6
7         w.setColor("lawngreen");
8         for (int i = 0; i < 12; i++) {
9             int p = 10 * i + 10;
10             w.drawLine(p, 0, p, 175);
11             w.drawLine(p + i, 0, p + i, 175);
12         }
13
14         w.setColor("black");
15         for (int i = 0; i < 12; i++) {
16             int p = 10 * i + 10;
17
18             w.drawCircle(p, 25, i);
19             w.fillCircle(p, 50, i);
20
21             w.drawRect(p, 75, p + i, 75 + i);
22             w.fillRect(p, 100, p + i, 100 + i);
23
24             w.drawTriangle(p, 125, p + i, 125 + i/2, p, 125 + i);
25             w.fillTriangle(p, 150, p + i, 150 + i/2, p, 150 + i);
26         }
27
28         w = new DrawingWindow("Test!", 800, 600);
29
30         w.setBgColor("red");
31         w.setColor("blue");
32         for (int i = 0; i < 10; i++) {
33             w.clearGraph();
34             for (int y = 0; y < w.height; y++) {
35                 for (int x = 0; x < w.width; x++) {
36                     w.drawPoint(x, y);
37                 }
38             }
39         }
40         w.setColor("white");
41         for (int i = 0; i < 10; i++) {
42             w.clearGraph();
43             for (int y = 0; y < w.height; y++) {
44                 for (int x = 0; x < w.width; x++) {
45                     w.drawPoint(x, y);
46                 }
47                 w.sync();
48             }
49         }
50         w.closeGraph();
51     }
52 }