Description
question 1
Write the class BoxCirclePanel which draws a random box and circle. The box is red and placed at a random location inside the panel. The square box also has a random size which is at most the current width of the panel. Similarly with the green circle.
You can find out the current size of the panel with getWidth() and getHeight() which both return an int.
Each time the code is run, the box and circle will be at a different location and have different sizes. The locations/sizes change as the window is re-sized. At times, only a partial box/circle will be shown. It is also possible for one of the box/circle to cover the other.
BoxCircle.java is provided. Please submit both BoxCirclePanel.java and BoxCircle.java
Sample run:
Initial window:
After making the window bigger:
The circle is covering the box:
question 2
Write MyPicture.java and MyPicturePanel.java which uses graphical objects (e.g., circles, ovals, squares, rectangles, text, colors, etc.) to draw an interesting picture. Be creative!
question 3
PP 4.16 on p. 204. IncrementDecrement.java is provided. Write the class IncrementDecrementPanel. Use a constant for the initial value. The panel size is 250 by 50. Submit IncrementDecrement.java and IncrementDecrementPanel.java
The initial GUI: