RedCross.java
1    /*write a program called RedCross within the npw package to paint a red cross (plus symbol) 
2     * in a 600 by 600 canvas whose legs are 500 by 100. Featured constraint: Create and use one 
3     */
4    
5    package npw;
6    
7    import java.awt.Color;
8    import javax.swing.SwingUtilities;
9    import painter.SPainter;
10   import shapes.SRectangle;
11   
12   public class RedCross {
13       //The solution to the red cross problem
14       private void paintTheImage() {
15           SPainter klee = new SPainter("Red Cross",600,600);
16           SRectangle cross = new SRectangle(500,100);
17           klee.setColor(Color.RED);
18           klee.paint(cross);
19           //Turn painter around
20           klee.tl();
21           klee.paint(cross);
22   
23       }
24   
25       //Required infrastructure
26   
27       public RedCross() {
28           paintTheImage();
29       }
30   
31       public static void main(String[] args) {
32           SwingUtilities.invokeLater(new Runnable() {
33               public void run() {
34                   new RedCross();
35               }
36           });
37       }
38   }