1 /* 2 * Program to paint a blue dot in the context of a Nonrepresentational 3 * Painting World, NPW 4 */ 5 6 package npw; 7 8 import painter.SPainter; 9 import shapes.SCircle; 10 import javax.swing.SwingUtilities; 11 import java.awt.Color; 12 13 public class Dots { 14 15 // THE SOLUTION TO THE BLUE DOT PROBLEM 16 private void paintTheImage() { 17 SPainter klee = new SPainter("Dots", 600, 600); 18 // AREA TO THE RIGHT OF THE Y AXIS 19 SCircle dot3 = new SCircle (15); 20 SCircle dot = new SCircle(25); 21 SCircle dot2 = new SCircle(35); 22 SCircle dot4 = new SCircle (45); 23 klee.setColor(Color.BLUE); 24 klee.mrt(150); 25 klee.paint(dot3); 26 klee.mrt(100); 27 klee.setRandomGreenColor(); 28 klee.paint(dot2); 29 klee.setColor(Color.BLUE); 30 klee.mlt(100); 31 klee.mfd(150); 32 klee.paint(dot4); 33 klee.mbk(300); 34 klee.paint(dot); 35 36 // AREA TO THE LEFT OF THE Y AXIS 37 klee.setColor(Color.BLUE); 38 klee.moveToCenter(); 39 klee.mlt(150); 40 klee.paint(dot3); 41 klee.mlt(100); 42 klee.paint(dot2); 43 klee.mrt(100); 44 klee.mfd(150); 45 klee.paint(dot4); 46 klee.mbk(300); 47 klee.setColor(Color.yellow); 48 klee.paint(dot); 49 klee.mlt(100); 50 klee.setColor(Color.white); 51 klee.paint(dot2); 52 } 53 // REQUIRED INFRASTRUCTURE 54 55 public Dots() { 56 paintTheImage(); 57 } 58 public static void main(String[] args) { 59 SwingUtilities.invokeLater(new Runnable() { 60 @Override 61 public void run() { 62 new Dots(); 63 } 64 }); 65 } 66 } 67