1 /* 2 * Program to paint a red cross using only one rectangle 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 15 //THE SOLUTION TO THE RED CROSS PROBLEM 16 17 private void paintTheImage() { 18 SPainter steve = new SPainter("Red Cross", 600,600); 19 SRectangle cross = new SRectangle (500,100); 20 steve.setColor(Color.RED); 21 steve.paint(cross); 22 steve.tl(); 23 steve.paint(cross); 24 } 25 26 //REQUIRED INFRASTRUCTURE 27 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