1 /* 2 * The DotS Assignment #1 3 */ 4 5 package npw; 6 7 import java.awt.Color; 8 import javax.script.ScriptContext; 9 import javax.swing.SwingUtilities; 10 import painter.SPainter; 11 import shapes.SCircle; 12 13 public class Dots { 14 15 // THE SOLUTION TO THE Dots PROBLEM 16 17 private void paintTheImage() { 18 SPainter owen = new SPainter("Dots", 600, 600); 19 SCircle dot = new SCircle(25); 20 owen.setColor(Color.black); 21 owen.paint(dot); 22 owen.setColor(Color.CYAN); 23 24 SCircle dot2 = new SCircle(40); 25 owen.mlt(80); 26 owen.paint(dot2); 27 owen.setColor(Color.BLUE); 28 29 SCircle dot3 = new SCircle( 60); 30 owen.mlt(120); 31 owen.paint(dot3); 32 owen.moveToCenter(); 33 owen.setColor(Color.BLUE); 34 35 SCircle dot4 = new SCircle(60); 36 owen.mrt(200); 37 owen.paint(dot3); 38 owen.setColor(Color.CYAN); 39 40 SCircle dot5 = new SCircle(40); 41 owen.moveToCenter(); 42 owen.mrt(80); 43 owen.paint(dot5); 44 owen.moveToCenter(); 45 46 SCircle dot6 = new SCircle(60); 47 owen.mfd(95); 48 owen.setColor(Color.BLUE); 49 owen.paint(dot6); 50 51 SCircle TheLastDots = new SCircle(100); 52 owen.mbk(250); 53 owen.mlt(150); 54 owen.setColor(Color.MAGENTA); 55 owen.paint(TheLastDots); 56 owen.moveToCenter(); 57 owen.mbk(155); 58 owen.mrt(150); 59 owen.paint(TheLastDots); 60 61 SCircle ForgottenDot = new SCircle(25); 62 owen.setColor(Color.black); 63 owen.moveToCenter(); 64 owen.mbk(155); 65 owen.paint(ForgottenDot); 66 67 68 69 70 } 71 72 //REQUIRED INFRASTRUCTURE 73 74 // it contains exactly 9 painted (filled in) circles 75 // it contains circles of exactly 4 different sizes 76 // it contains circles of exactly 4 different colors 77 // none of the circles touch 78 // the image is symmetric about the Y-axis 79 // not all of the circles touch the Y-axis 80 81 public Dots() { 82 paintTheImage(); 83 } 84 85 public static void main(String[] args) { 86 SwingUtilities.invokeLater(new Runnable () { 87 public void run() { 88 new Dots(); 89 } 90 }) ; 91 } 92 }