Assignment 4: Graphics and Drawing - Due Monday, July 7th

This assignment will be the first that we used Java's graphic abilities. You need to create a GUI. This GUI must:

  1. Display an Image (you can choose one.. about 50x50 pixels will probably be a good size). This should be more or less centered (off by a few pixels ok - noticeably off to one side isn't).
  2. Have two JButtons. One of the JButtons will change the background to a random color. The other will should draw a shape (a circle OR a rectangle, randomly chosen) around the image. This should also be centered.
  3. Extra Credit 10%: Add another shape other than one of the predefined Java2D ones (a triangle is fine)
  4. Extra Credit 10%: Make all your code centering itself be DYNAMIC. If the program is run, and the user maximizes the screen, everything should re-center itself (Layout Managers help with this!)
So, it should look like this when it is just opened

and then like this when a each button is pressed once


Some hints on doing this.