1 /* 2 * Program to paint a red target in the context of the nonrepresentational 3 * Painting world, NPW. 4 */ 5 6 package npw; 7 8 import java.awt.Color; 9 import javax.swing.SwingUtilities; 10 import painter.SPainter; 11 import shapes.SCircle; 12 13 public class Target { 14 15 // THE SOLUTION TO THE RED TARGET PROBLEM 16 private void paintTheImage() { 17 SPainter klee = new SPainter("Target", 600, 600); 18 SCircle dot = new SCircle(300); 19 klee.setColor(Color.RED); 20 klee.paint(dot); 21 SCircle ring = new SCircle(200); 22 klee.setColor(Color.white); 23 klee.paint(ring); 24 SCircle center = new SCircle(100); 25 klee.setColor(Color.red); 26 klee.paint(center); 27 } 28 29 // REQUIRED INFRASTRUCTURE 30 31 public Target() { 32 paintTheImage(); 33 } 34 35 public static void main(String[] args) { 36 SwingUtilities.invokeLater(new Runnable() { 37 public void run() { 38 new Target(); 39 } 40 }); 41 } 42 43 }