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