// Tyler Rigsby, CSE 142 // Demonstrates basics of using graphics. // Abstract Windowing Toolkit -- for Graphics import java.awt.*; public class GraphicsDemo { public static void main(String[] args) { // Type name = new Type(params); // width, height DrawingPanel panel = new DrawingPanel(600, 600); Graphics paintbrush = panel.getGraphics(); paintbrush.drawRect(150, 150, 50, 100); paintbrush.setColor(Color.RED); // x1, y1, x2, y2 paintbrush.drawLine(50, 50, 150, 150); paintbrush.setColor(Color.CYAN); // x, y, w, h paintbrush.fillRect(150, 150, 50, 100); paintbrush.setColor(Color.BLACK); paintbrush.drawRect(200, 350, 100, 50); paintbrush.drawRect(150, 150, 50, 100); paintbrush.setColor(Color.PINK); // x, y, w, h paintbrush.fillOval(200, 350, 100, 50); } }