1 /* 2 Program to paint a red cross using the NPW Package 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 TheRedCross { 13 14 private void paintTheImage() { 15 SPainter klee = new SPainter("The Red Cross", 600, 600); 16 SRectangle verticalCross = new SRectangle(500,100); 17 klee.setColor(Color.RED); 18 klee.paint(verticalCross); 19 klee.tr(); 20 klee.paint(verticalCross); 21 22 } 23 // REQUIRED INFRASTRUCTURE 24 25 public TheRedCross() { 26 paintTheImage(); 27 } 28 public static void main(String[] args) { 29 SwingUtilities.invokeLater(new Runnable() { 30 public void run() { 31 new TheRedCross(); 32 } 33 }); 34 } 35 } 36