1 package npw; 2 3 import java.awt.Color; 4 import javax.swing.SwingUtilities; 5 import painter.SPainter; 6 import shapes.SCircle; 7 8 public class Dots { 9 10 private void paintTheImage() { 11 SPainter John = new SPainter("Dots", 600, 600); 12 SCircle Dot1 = new SCircle(10); 13 //Red 14 SCircle Dot2 = new SCircle(20); 15 //blue 16 SCircle Dot3 = new SCircle(30); 17 //green 18 SCircle Dot4 = new SCircle(40); 19 //yellow 20 John.setColor(Color.red); 21 John.paint(Dot1); 22 John.mfd(80); 23 John.paint(Dot1); 24 John.moveToCenter(); 25 John.mbk(70); 26 John.paint(Dot1); 27 John.moveToCenter(); 28 John.mfd(80); 29 John.mrt(60); 30 John.setColor(Color.yellow); 31 John.paint(Dot4); 32 John.mlt(120); 33 John.paint(Dot4); 34 John.moveToCenter(); 35 John.mbk(70); 36 John.mrt(60); 37 John.setColor(Color.green); 38 John.paint(Dot3); 39 John.mlt(120); 40 John.paint(Dot3); 41 John.moveToCenter(); 42 John.mrt(60); 43 John.setColor(Color.blue); 44 John.paint(Dot2); 45 John.mlt(120); 46 John.paint(Dot2); 47 48 } 49 //Required infastructure 50 51 public Dots(){ 52 paintTheImage(); 53 } 54 55 public static void main(String[] args) { 56 SwingUtilities.invokeLater(new Runnable() { 57 public void run() { 58 new Dots(); 59 } 60 }); 61 } 62 } 63