RedCross.java
1    /* 
2    * CREATE A PROGRAM TO DRAW A RED CROSS 
3    * 2 RECTANGLES 
4     */
5    
6    package npw;
7    
8    import java.awt.Color;
9    import javax.swing.*;
10   
11   import painter.SPainter;
12   import shapes.SRectangle;
13   
14   
15   public class RedCross {
16       // ONE RECTANGLE OBJECT
17   
18       private void paintTheImage() {
19           SPainter klee = new SPainter("RedCross", 600, 600);
20           SRectangle line = new SRectangle(100, 500);
21           klee.setColor(Color.RED);
22           paintHorizontalLine (klee,line);
23           paintVerticalLine (klee,line);
24   
25   
26       }
27   
28       private void paintHorizontalLine(SPainter klee,SRectangle line) {
29   
30           klee.paint(line);
31       }
32   
33       public void paintVerticalLine (SPainter klee,SRectangle line) {
34           klee.setHeading(90);
35           klee.paint(line);
36       }
37   
38   
39   
40   
41   
42       //REQUIRED INFRASTRUCTURE
43   
44       public RedCross() {
45           paintTheImage();
46       }
47   
48       public static void main(String[] args) {
49           SwingUtilities.invokeLater(new Runnable() {
50               public void run() {
51                   new RedCross();
52               }
53           });
54       }
55   }
56   
57   
58   
59