Question
Create a java program that draws 10 random filled shapes in random colors, positions and sizes. Method paintComponent should contain a loop that iterates 10
Create a java program that draws 10 random filled shapes in random colors, positions and sizes. Method paintComponent should contain a loop that iterates 10 times. In each iteration, the loop should determine whether to draw a filled rectangle or an oval, create a random color and choose coordinates and dimensions at random. The coordinates should be chosen based on the panels width and height. Lengths of sides should be limited to half the width or height of the window. One sample output looks like the following (the output display varies greatly from time to time).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started