2 public static void main(String[] args) {
3 DrawingWindow w1 = new DrawingWindow("Test!", 400, 400);
5 w1.setColor("lawngreen");
6 for (int i = 0; i < 12; i++) {
8 w1.drawLine(p, 0, p, 175);
9 w1.drawLine(p + i, 0, p + i, 175);
13 for (int i = 0; i < 12; i++) {
16 w1.drawCircle(p, 25, i);
17 w1.fillCircle(p, 50, i);
19 w1.drawRect(p, 75, p + i, 75 + i);
20 w1.fillRect(p, 100, p + i, 100 + i);
22 w1.drawTriangle(p, 125, p + i, 125 + i/2, p, 125 + i);
23 w1.fillTriangle(p, 150, p + i, 150 + i/2, p, 150 + i);
26 // Try out of bounds drawings
28 w1.drawLine(-10, w1.height - 10, w1.width + 10, w1.height - 10);
29 w1.drawLine(w1.width - 10, -10, w1.width - 10, w1.height + 10);
31 for (int x = -10; x <= w1.width + 10; x++)
32 w1.drawPoint(x, w1.height - 20);
33 for (int y = -10; y <= w1.height + 10; y++)
34 w1.drawPoint(w1.width - 20, y);
36 DrawingWindow w2 = new DrawingWindow("Test!", 800, 600);
39 for (int i = 0; i < 3; i++) {
41 for (int y = 0; y < w2.height; y++) {
42 for (int x = 0; x < w2.width; x++) {
48 for (int i = 0; i < 3; i++) {
50 for (int y = 0; y < w2.height; y++) {
51 for (int x = 0; x < w2.width; x++) {
59 System.out.println("Click anywhere on w1...");
62 while (w1.waitMousePress(5 * 1000)) {
63 int x = w1.getMouseX();
64 int y = w1.getMouseY();
65 System.out.println("[ " + x + " ; " + y + " ] - " +
67 w1.drawLine(x - 5, y, x + 5, y);
68 w1.drawLine(x, y - 5, x, y + 5);
71 System.out.println("Done!");