Dots.java
1    package npw;
2    
3    import painter.SPainter;
4    import shapes.SCircle;
5    import shapes.SRectangle;
6    
7    import javax.swing.*;
8    import java.awt.*;
9    
10   public class Dots {
11   
12   
13   
14   /* 
15    * Program to paint a bunch of dots in the context of the Nonrepresentational 
16    * Painting World, NPW. 
17    */
18   
19   
20       // THE SOLUTION TO THE DOTS PROBLEM
21   
22       private void paintTheImage() {
23           SPainter klee = new SPainter("Dots",600,600);
24           klee.tr();
25           SRectangle axis = new SRectangle(1,200);
26           klee.setColor(Color.BLACK);
27           SCircle dot1 = new SCircle(25);
28           SCircle dot2 = new SCircle(50);
29           SCircle dot3 = new SCircle(75);
30           SCircle dot4 = new SCircle(20);
31   
32           klee.mfd(50);
33           klee.paint(dot1);
34           klee.mbk(100);
35           klee.paint(dot1);
36   
37           klee.setColor(Color.RED);
38           klee.tl();
39           klee.mfd(150);
40           klee.paint(dot2);
41           klee.tr();
42           klee.mfd(102);
43           klee.paint(dot2);
44   
45           klee.moveToCenter();
46           klee.setColor(Color.BLUE);
47           klee.mbk(200);
48           klee.paint(dot3);
49           klee.mfd(400);
50           klee.paint(dot3);
51   
52           klee.moveToCenter();
53           klee.setColor(Color.PINK);
54           klee.mfd(100);
55           klee.paint(dot4);
56           klee.mbk(200);
57           klee.paint(dot4);
58   
59           klee.moveToCenter();
60           klee.setColor(Color.BLUE);
61           klee.tr();
62           klee.mfd(150);
63           klee.paint(dot3);
64   
65   
66   
67       }
68   
69   // REQUIRED INFRASTRUCTURE
70   
71       public Dots() {
72           paintTheImage();
73       }
74   
75       public static void main(String[] args) {
76           SwingUtilities.invokeLater(new Runnable() {
77               public void run() {
78                   new Dots();
79               }
80           });
81       }
82   
83   }
84