1 package npw; 2 3 import javax.swing.*; 4 import java.awt.*; 5 import java.awt.Color; 6 import javax.swing.SwingUtilities; 7 import painter.SPainter; 8 import shapes.SRectangle; 9 10 //Program to paint a red cross 11 12 public class RedCross { 13 14 private void paintTheImage(){ 15 SPainter painter1 = new SPainter("Red Cross", 600, 600); 16 SRectangle rect1 = new SRectangle(500, 100); 17 painter1.setColor(Color.RED); 18 painter1.paint(rect1); 19 rect1.setHeight(100); 20 rect1.setWidth(500); 21 painter1.paint(rect1); 22 } 23 24 public RedCross(){ 25 paintTheImage(); 26 } 27 28 public static void main(String[] args){ 29 SwingUtilities.invokeLater(new Runnable(){ 30 public void run(){ 31 new RedCross(); 32 } 33 }); 34 } 35 } 36