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 klee = new SPainter("Red Cross" , 600, 600); 18 SRectangle rec = new SRectangle(500, 100); 19 klee.setColor(Color.RED); 20 klee.paint(rec); 21 rec.resetHeight(100); 22 rec.resetWidth(500); 23 klee.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 }