1 package npw; 2 3 import java.awt.Color; 4 import javax.swing.SwingUtilities; 5 import painter.SPainter; 6 import shapes.*; 7 8 public class RedCross { 9 10 /* 11 * Program to paint a blue dot in the context of the nonrepresentational 12 * Painting World, NPW 13 * 14 */ 15 16 //The solution to the Red Cross problem 17 18 private void paintTheImage() { 19 20 SPainter painter = new SPainter("Red Cross", 600, 600); 21 SRectangle rectangle = new SRectangle(500, 100); 22 painter.setColor(Color.RED); 23 painter.paint(rectangle); 24 rectangle = new SRectangle(100, 500); 25 painter.paint(rectangle); 26 27 } 28 29 //Required infrastructure 30 31 public RedCross() { paintTheImage(); } 32 33 public static void main(String[] args) { 34 35 SwingUtilities.invokeLater(new Runnable() { 36 @Override 37 public void run() { 38 new RedCross(); 39 } 40 }); 41 42 } 43 44 45 }