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