// CSE 142, Summer 2008 (Marty Stepp) // This program is our first example of drawing graphics with DrawingPanel. // I need to save DrawingPanel.java in the same folder as my program. import java.awt.*; // so that I can use Graphics public class DrawExample { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(400, 500); panel.setBackground(Color.GREEN); Graphics g = panel.getGraphics(); g.drawRect(10, 50, 100, 200); g.fillOval(10, 50, 100, 100); g.setColor(Color.RED); g.drawLine(150, 70, 20, 290); g.drawString("142 is great", 40, 110); g.setColor(Color.CYAN); g.fillRect(50, 200, 50, 50); } }