1 /* 2 * Program to paint a red cross 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.SRectangle; 12 13 public class RedCross { 14 // THE SOLUTION TO THE RED CROSS PROBLEM 15 16 private void paintTheImage () { 17 SPainter painter = new SPainter ("Red Cross", 600, 600); 18 SRectangle rectangle = new SRectangle(110, 500); 19 painter.setColor(Color.RED); 20 painter.paint(rectangle); 21 rectangle = new SRectangle(500, 110); 22 painter.setColor(Color.RED); 23 painter.paint(rectangle); 24 } 25 26 27 // REQUIRED INFRASTRUCTURE 28 public RedCross() { 29 paintTheImage(); 30 } 31 32 public static void main(String[] args) { 33 SwingUtilities.invokeLater(new Runnable() { 34 public void run() { 35 new RedCross(); 36 } 37 }); 38 } 39 40 }