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