package npw; /* * this program draws a cross on a canvas */ // imported subjects bellow vvvvvvv import painter.SPainter; import shapes.SRectangle; import javax.swing.*; import java.awt.*; // this is the "top level cod e" for painting the cross bellow vvvvvv public class TheRedCross { private void paintTheImage() { SPainter painter = new SPainter(" TheRedCross", 600, 600); SRectangle cross = new SRectangle(100, 500); paintRectangle1(painter, cross); } private void paintRectangle1(SPainter painter, SRectangle cross){ painter.setColor(Color.red); painter.paint(cross); painter.setHeading(90); painter.paint(cross); painter.setHeading(90); } // this code is infrastructure. vvvv public TheRedCross(){ paintTheImage(); } // the code bellow is also infrastructure. vvvvv public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run () { new TheRedCross(); } }); } }