ASSIGNMENT #3: Circles
Score: 10 points
Bonus: 2 points (see below)
I hope you remember the circle program, demonstrated in class on Wednesday. If not, here's a
picture that should give you the idea:
Your task: Make some changes to understand the underlying event structure !
You will get the source code of the original program. Compile it, run it, make sure everything's fine.
Play around with it, so you get an idea what's happening. That's just to warm up. The real task
description comes here (the description order is not necessarily the order you should work on the assignment,
please read the full description first and make sure you understood):
- Change the frame in a way that it only shows a single circle + button (that's simple)
- The button should not switch the circle on/off, but toggle its color between... whatever 2 colors you want.
- Show 10 of these frames (each containing a single circle and its button). Make them single, INDEPENDENT
frames, not to be put together in any layout of a container frame! This means, at this point you should have 10 frames on the screen.
- Create another (the 11th) frame, just containing a button. This button should work as the master toggle button, it
should toggle the colors of all circles.
If you want 2 Bonus points, here comes the extended version !
- Let the extra window not only contain a button, but also a slider. The slider should control the size of all circles.
A slider is a swing component that sends 'ChangeEvents'. Find in the web how to use sliders and how to register your class
to a slider.
The source code for the 2 circles is HERE !
Some hints:
- The control window, i.e. the frame containing the master-button (and maybe a slider), is a good place for the main
program.
-
Good luck and have fun !