// Name: Whitaker Brand // TA: Isaac // Course: CSE142 // Quarter: 17au // This is an example usage of DrawingPanel to draw an // awesome A-Team van. // // // NOTE: the implementation of this car isn't that great, // because it doesn't let us change the x and y // location of the car (see Car2.java) or the size // of the car -- Car3.java has the best improved version. // import java.awt.*; public class Car1 { public static void main(String[] args) { DrawingPanel drawPanel = new DrawingPanel(700, 1000); // width, height Graphics pen = drawPanel.getGraphics(); // // This statement would draw a line from (0,0) to (100, 100) // pen.drawLine(0, 0, 100, 100); // drawCar(pen); } // Uses the given Graphics object to draw a car. The top-left // location of the car is (10,100) public static void drawCar(Graphics g) { // // This statement will draw a full rectangle from (10,100) // and 200px wide, and 100px tall (in the downward direction) // g.fillRect(10, 100, 200, 100); g.fillOval(15, 170, 60, 60); g.fillOval(145, 170, 60, 60); g.setColor(Color.BLUE); g.fillRect(140, 120, 70, 40); g.setColor(Color.RED); g.fillRect(10, 140, 100, 10); } }