Use the code shown here as an example to draw your own squares (or rectangles). Shown are two examples, one for a filled square, one for an unfilled.
Just like before, we set the color before we draw the square. We then tell it the coordinates to place the square, as well as the width and height we want the square to be.
Try practicing this code by making your own squares in different positions with different sizes, experimentation is key!
Once you’ve gotten the hang of this, you’ve now practiced and used all of the basic shapes in Java drawing! Now try to use these tools to create something for yourself! It will probably be hard at first, but it’s very fun once you get the hang of it. Keep the drawing simple at first, something like a snowman or a house would be good examples of some simple things you can try to draw.