// Helene Martin, CSE 142 // Demonstrates basic 2D graphics with DrawingPanel. import java.awt.*; // Advanced Windowing Toolkit (for Graphics, Color) public class GraphicsDemo { public static void main(String[] args) { // need to have DrawingPanel.java in same folder as GraphicsDemo.java DrawingPanel p = new DrawingPanel(600, 400); // g is our "paintbrush" Graphics g = p.getGraphics(); //x1, y1, x2, y2 g.drawLine(10, 10, 80, 80); //x1, y1, w, h g.drawRect(80, 80, 40, 80); g.drawOval(80, 80, 40, 80); g.setColor(Color.PINK); // dipping our paintbrush in pink // loops that start at 0 make coordinates easier // first circle is at (200, 100) for(int i = 0; i < 10; i++) { g.fillOval(200 + 20 * i, 100, 100, 100); } } }