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