Dots.java
1    /* 
2     *Program to paint circles of different colors and sizes and do not touch each other in the context of the Nonrepresentational 
3     * Painting World, NPW. They must also be symmetric about the Y axis 
4     */
5    package npw;
6    
7    //Necessary codes that to tell java where to get the Shapes, color, canvas and so on.
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       private void paintTheImage() {
16   
17           SPainter tile = new SPainter("Dots",700,700); //Had to use a bigger canvas here for extra space
18   
19           SCircle XLdots = new SCircle(100); //The biggest circle is named XLdots
20           SCircle Ldots = new SCircle(70); //The large circle is named LDots
21           SCircle dots = new SCircle(50);  // A normal circle so just Dots :)
22           SCircle Mdots = new SCircle(25);  //The mini circle is called MDots
23   
24           paintMiniDots(tile, Mdots);
25           paintMediumDots(tile, dots);
26           paintLargeDots(tile, Ldots);
27           paintXLargeDots(tile, XLdots);
28       }
29       public Dots() {
30           paintTheImage();
31       }
32       // Infrastructure for some simple painting
33       public static void main(String[] args) {
34           SwingUtilities.invokeLater(new Runnable() {
35               public void run() {
36                   new Dots();
37               }
38           });
39       }
40   /* I sketched my intended result on a paper. To be on the safe side, I did the center dot last 
41   *This was because i felt i could edit the rest easily 
42    */
43       private void paintMediumDots(SPainter tile, SCircle dots){
44           //starting with the medium, we make the color red and move the circle to its coordinates
45           tile.setColor(Color.RED);
46           tile.mfd(200);
47           tile.mlt(200);
48           tile.paint(dots);
49           /* After painting, I always move it to double the value of its horizontal coordinates. 
50           /* Its horizontal coordinates is any value on the "mlt" or "mrt" command 
51           * This creates the "reflection" which is going to be used throughout this program 
52            */
53           tile.mrt(400);
54           tile.paint(dots);
55           tile.moveToCenter(); //invariance to take the canvas back to center for another circle to be painted
56       }
57       private void paintMiniDots(SPainter tile, SCircle Mdots) {
58           tile.setColor(Color.MAGENTA);
59           tile.mfd(125);
60           tile.mlt(100);
61           tile.paint(Mdots);
62           tile.mrt(200);
63           tile.paint(Mdots);
64           tile.moveToCenter();
65       }
66       private void paintLargeDots(SPainter tile, SCircle Ldots) {
67           tile.setColor(Color.YELLOW);
68           tile.mbk(125);
69           tile.mlt(150);
70           tile.paint(Ldots);
71           tile.mrt(300);
72           tile.paint(Ldots);
73           tile.moveToCenter();
74           tile.setColor(Color.GREEN);
75           tile.mbk(250);
76           tile.mlt(250);
77           tile.paint(Ldots);
78           tile.mrt(500);
79           tile.paint(Ldots);
80           tile.moveToCenter();//Final invariance that moves the canvas to the center so the big circle can be painted
81       }
82       private void paintXLargeDots(SPainter tile, SCircle XLdots) {
83           tile.setColor(Color.RED);
84           tile.paint(XLdots);
85       }
86   
87   }
88