Dots.java
1    package npw;
2    
3    import painter.SPainter;
4    import shapes.SCircle;
5    import javax.swing.*;
6    import java.awt.*;
7    import java.awt.Color;
8    import javax.swing.SwingUtilities;
9    
10   //Program to paint 9 dots according to given constraints
11   
12   public class Dots {
13       private void paintTheImage(){
14           SPainter pa = new SPainter("Dots", 800, 800);
15           SCircle dot1 = new SCircle(50); //
16           SCircle dot2 = new SCircle(50); //
17           SCircle dot3 = new SCircle(100);//
18           SCircle dot4 = new SCircle(100);//
19           SCircle dot5 = new SCircle(150);//
20           SCircle dot6 = new SCircle(150);//
21           SCircle dot7 = new SCircle(100);
22           SCircle dot8 = new SCircle(100);
23           SCircle dot9 = new SCircle(50);  //
24   
25           pa.setColor(Color.RED);
26           pa.location.setLocation(100,50);
27           pa.paint(dot1);
28           pa.location.setLocation(0,0);
29   
30           pa.setColor(Color.GREEN);
31           pa.location.setLocation(700,50);
32           pa.paint(dot2);
33           pa.location.setLocation(0,0);
34   
35           pa.setColor(Color.BLUE);
36           pa.location.setLocation(200,200);
37           pa.paint(dot3);
38           pa.location.setLocation(0,0);
39   
40           pa.setColor(Color.BLUE);
41           pa.location.setLocation(600,200);
42           pa.paint(dot4);
43           pa.location.setLocation(0,0);
44   
45           pa.setColor(Color.RED);
46           pa.location.setLocation(200,500);
47           pa.paint(dot5);
48           pa.location.setLocation(0,0);
49   
50           pa.setColor(Color.GREEN);
51           pa.location.setLocation(600,500);
52           pa.paint(dot6);
53           pa.location.setLocation(0,0);
54   
55           pa.setColor(Color.GRAY);
56           pa.location.setLocation(400,300);
57           pa.paint(dot7);
58           pa.location.setLocation(0,0);
59   
60           pa.setColor(Color.GRAY);
61           pa.location.setLocation(400,675);
62           pa.paint(dot8);
63           pa.location.setLocation(0,0);
64   
65           pa.setColor(Color.GRAY);
66           pa.location.setLocation(400,50);
67           pa.paint(dot9);
68           pa.location.setLocation(0,0);
69   
70       }
71   
72       public Dots(){
73           paintTheImage();
74       }
75   
76       public static void main(String[] args){
77           SwingUtilities.invokeLater(new Runnable(){
78               public void run(){
79                   new Dots();
80               }
81           });
82       }
83   }
84   
85   
86   
87