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