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