Dots.java
1    /* 
2    * A program that creates a mirror image of 6 circles in 3 different sizes and colors that don't touch 
3     */
4    
5    package npw;
6    import java.awt.Color;
7    import java.awt.geom.Point2D;
8    import javax.swing.SwingUtilities;
9    import painter.SPainter;
10   import shapes. SCircle;
11   import shapes.SSquare;
12   
13   public class Dots {
14       private void paintTheImage(){
15           SPainter painter = new SPainter("Dots",400,400);
16           SCircle grayCircles = new SCircle(25);
17           SCircle yellowCircles = new SCircle(50);
18           SCircle pinkCircles = new SCircle(75);
19   
20           Point2D.Double location1 = new Point2D.Double(200, 100);
21           Point2D.Double location2 = new Point2D.Double(200, 150);
22           Point2D.Double location3 = new Point2D.Double(200, 200);
23           Point2D.Double location4 = new Point2D.Double(200, 250);
24           Point2D.Double location5 = new Point2D.Double(200, 300);
25   
26   
27           paintGrayCircles(painter, grayCircles, location1, location2, location3, location4, location5);
28           paintYellowCircles(painter, yellowCircles);
29           paintPinkCircles(painter, pinkCircles);
30       }
31   
32       private void paintPinkCircles(SPainter painter, SCircle pinkCircles) {
33           painter.mfd(120);
34           painter.mrt(120);
35           painter.setColor(Color.PINK);
36           painter.paint(pinkCircles);
37           painter.moveToCenter();//Invariance
38           painter.mfd(120);
39           painter.mlt(110);
40           painter.paint(pinkCircles);
41           painter.moveToCenter();//Invariance
42       }
43   
44       private void paintGrayCircles(SPainter painter, SCircle grayCircles, Point2D.Double location1,
45                                     Point2D.Double location2, Point2D.Double location3, Point2D.Double location4,
46                                     Point2D.Double location5) {
47           painter.setPosition(location1);
48           painter.setColor(Color.GRAY);
49           painter.paint(grayCircles);
50           painter.setPosition(location2);
51           painter.paint(grayCircles);
52           painter.setPosition(location3);
53           painter.paint(grayCircles);
54           painter.setPosition(location4);
55           painter.paint(grayCircles);
56           painter.setPosition(location5);
57           painter.paint(grayCircles);
58           painter.moveToCenter();//Invariance
59       }
60   
61       private void paintYellowCircles(SPainter painter, SCircle yellowCircles) {
62           painter.mbk(100);
63           painter.mrt(110);
64           painter.setColor(Color.YELLOW);
65           painter.paint(yellowCircles);
66           painter.moveToCenter();//Invariance
67           painter.mbk(100);
68           painter.mlt(100);
69           painter.paint(yellowCircles);
70           painter.moveToCenter();//Invariance
71       }
72   
73   
74       //Required Infrastucture
75   
76       public Dots(){
77           paintTheImage();
78       }
79   
80       public static void main (String[] args) {
81           SwingUtilities.invokeLater(new Runnable() {
82               public void run() {
83                   new Dots();
84               }
85           });
86       }
87   }
88