1 /* 2 * Programming Challenge #1: Create the Red Cross symbol 3 * using only one rectangle with sides 500x100 4 */ 5 6 package npw; 7 8 9 import java.awt.Color; 10 import javax.swing.SwingUtilities; 11 import javax.xml.parsers.SAXParser; 12 13 import painter.SPainter; 14 import shapes.SRectangle; 15 16 public class RedCross { 17 //The Solution to the Red Cross Problem 18 private void paintTheImage() { 19 SPainter friend = new SPainter("RedCross", 600, 600); 20 SRectangle alpha = new SRectangle(500, 100); 21 friend.setColor(Color.RED); 22 friend.paint(alpha); 23 24 alpha.setHeight(100); 25 alpha.setWidth(500); 26 27 friend.paint(alpha); 28 } 29 30 //Required Infrastructure 31 32 public RedCross() { 33 paintTheImage(); 34 } 35 36 public static void main(String[] args) { 37 SwingUtilities.invokeLater(new Runnable() { 38 public void run() { 39 new RedCross(); 40 } 41 }); 42 } 43 } 44