Dots.java
1    /* 
2     * Program to paint 9 dots in the context of the Nonrepresentational 
3     * Painting World, NPW. 
4     */
5    
6            package npw;
7    
8    import java.awt.Color;
9    import javax.swing.SwingUtilities;
10   import painter.SPainter;
11   import shapes.SCircle;
12   
13   public class Dots {
14   
15       //THE SOLUTION TO THE DOT PROBLEM
16   
17       private void paintTheImage() {
18           SPainter klee = new SPainter("Dots",600,600);
19           SCircle dot = new SCircle(50);
20           klee.setColor(Color.BLUE);
21           klee.paint(dot);
22           klee.mrt(150);
23           klee.paint(dot);
24           klee.mlt(300);
25           klee.paint(dot);
26           klee.mrt(150);
27   
28           SCircle spot = new SCircle(75);
29           klee.setColor(Color.RED);
30           klee.mfd(150);
31           klee.mrt(175);
32           klee.paint(spot);
33           klee.mlt(350);
34           klee.paint(spot);
35           klee.mrt(175);
36           klee.mbk(150);
37   
38           SCircle mot = new SCircle(25);
39           klee.setColor(Color.GREEN);
40           klee.mfd(120);
41           klee.paint(mot);
42           klee.mbk(240);
43           klee.paint(mot);
44           klee.mfd(120);
45   
46           SCircle bot = new SCircle(45);
47           klee.setColor(Color.CYAN);
48           klee.mbk(150);
49           klee.mrt(125);
50           klee.paint(bot);
51           klee.mlt(250);
52           klee.paint(bot);
53           klee.mrt(125);
54           klee.mfd(150);
55   
56   
57       }
58   
59       // REQUIRED INFRASTRUCTURE
60   
61       public Dots() {
62           paintTheImage();
63       }
64   
65       public static void main(String[] args) {
66           SwingUtilities.invokeLater(new Runnable() {
67               public void run() {
68                   new Dots();
69               }
70           });
71       }
72   }
73