// This program draws a rudimentary van using DrawingPanel. // Note the import statement and the use of the Color and Graphics classes. // // You must download DrawingPanel.java from the course website and save it // in the same folder as this file to run this program. import java.awt.*; public class Drawing { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(400, 200); panel.setBackground(Color.LIGHT_GRAY); Graphics brush = panel.getGraphics(); drawVan(brush); } // draw a single van // // Graphics pen - the Graphics object to use when drawing public static void drawVan(Graphics pen) { // draw body pen.setColor(Color.BLACK); pen.fillRect(10, 30, 100, 50); // draw wheels pen.setColor(Color.RED); pen.fillOval(20, 70, 20, 20); pen.fillOval(80, 70, 20, 20); // draw windshield pen.setColor(Color.CYAN); pen.fillRect(80, 40, 30, 20); } }