1 package npw; 2 3 import java.awt.*; 4 import javax.swing.*; 5 import painter.SPainter; 6 import shapes.SRectangle; 7 8 public class RedCross { 9 10 //THE SOLUTION TO THE RED CROSS PROBLEM 11 12 private void paintTheImage(){ 13 SPainter painter = new SPainter("Red Cross", 600, 600); 14 SRectangle rect = new SRectangle(500, 100); 15 painter.setColor(Color.RED); 16 painter.paint(rect); 17 18 rect.setHeight(100); rect.setWidth(500); 19 painter.paint(rect); 20 } 21 22 public RedCross() { 23 paintTheImage(); 24 } 25 26 public static void main(String[] args){ 27 SwingUtilities.invokeLater(new Runnable() { 28 public void run() { 29 new RedCross(); 30 } 31 } 32 ); 33 } 34 35 } 36