Practice: Graphics Class

Take out a piece of paper. We’ll be programming on paper.

Problem 1

Write the paintComponent(Graphics g) method that creates a square at position (25, 30) with a width and height of 50 pixels.

Problem 2

Write the same paintComponent(Graphics g) method using a different way of drawing the square.

Problem 3

Write the paintComponent(Graphics g) that creates a square with a width and height of 50 pixels in the center of the component. How do you find the width and height of a component?

Show me your code before you leave