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   
11   import painter.SPainter;
12   import painter.SPainter;
13   import shapes.SRectangle;
14   import shapes.SRectangle;
15   
16   public class RedCross {
17       //THE SOLUTION TO THE RECROSS PROBLEM
18   
19       private void paintTheImage() {
20           SPainter klee = new SPainter("RedCross",600,600);
21           //Creating rectangle1
22           SRectangle cross= new SRectangle (500,100);
23           klee.setColor(Color.RED);
24           klee.paint(cross);
25           //Creating rectangle2
26           cross.resetHeight(100);
27           cross.resetWidth(500);
28           klee.setColor(Color.RED);
29           klee.paint(cross);
30   
31       }
32       //REQUIRED INFRASTRUCTURE
33       public RedCross(){
34           paintTheImage();
35       }
36       public static void main (String []args){
37           SwingUtilities.invokeLater(new Runnable() {
38               public void run() {
39                   new RedCross();
40               }
41           });
42       }
43   }