class Test{
public static void main(String[] args) {
- DrawingWindow w = new DrawingWindow("Test!", 400, 400);
-
- w.setColor("green");
+ DrawingWindow w1 = new DrawingWindow("Test!", 400, 400);
+ w1.setColor("lawngreen");
for (int i = 0; i < 12; i++) {
int p = 10 * i + 10;
- w.drawLine(p, 0, p, 175);
- w.drawLine(p + i, 0, p + i, 175);
+ w1.drawLine(p, 0, p, 175);
+ w1.drawLine(p + i, 0, p + i, 175);
}
- w.setColor("black");
+ w1.setColor("black");
for (int i = 0; i < 12; i++) {
int p = 10 * i + 10;
- w.drawCircle(p, 25, i);
- w.fillCircle(p, 50, i);
+ w1.drawCircle(p, 25, i);
+ w1.fillCircle(p, 50, i);
+
+ w1.drawRect(p, 75, p + i, 75 + i);
+ w1.fillRect(p, 100, p + i, 100 + i);
- w.drawRect(p, 75, p + i, 75 + i);
- w.fillRect(p, 100, p + i, 100 + i);
+ w1.drawTriangle(p, 125, p + i, 125 + i/2, p, 125 + i);
+ w1.fillTriangle(p, 150, p + i, 150 + i/2, p, 150 + i);
+ }
- w.drawTriangle(p, 125, p + i, 125 + i/2, p, 125 + i);
- w.fillTriangle(p, 150, p + i, 150 + i/2, p, 150 + i);
+ DrawingWindow w2 = new DrawingWindow("Test!", 800, 600);
+ w2.setBgColor("red");
+ w2.setColor("blue");
+ for (int i = 0; i < 3; i++) {
+ w2.clearGraph();
+ for (int y = 0; y < w2.height; y++) {
+ for (int x = 0; x < w2.width; x++) {
+ w2.drawPoint(x, y);
+ }
+ }
}
+ w2.setColor("white");
+ for (int i = 0; i < 3; i++) {
+ w2.clearGraph();
+ for (int y = 0; y < w2.height; y++) {
+ for (int x = 0; x < w2.width; x++) {
+ w2.drawPoint(x, y);
+ }
+ w2.sync();
+ }
+ }
+ w2.closeGraph();
+
+ while (w1.waitMousePress(5 * 1000))
+ System.out.println("[ " + w1.getMouseX() + " ; " + w1.getMouseY() +
+ " ] -- button " + w1.getMouseButton());
+
+ System.out.println("Done!");
}
-}
\ No newline at end of file
+}