After you set up the layout and put the buttons/checkboxes on it then the program plan/structure might be the following: 1. Pick three random values between 0 and 2 for each button/checkbox 2. Add listeners for each button/checkbox 3. Check which event took place (which button or checkbox were used). For each choice write logic where some counter (from 0 to 2) will be incremented (in a circular way: from 2 goes back to 0) for each time the button has been clicked and set the new color for each counter state for each button (for example, if the counter wa 0 then button1.setIcon(green); and so on) 4. If the button "Try me" has been clicked then check if the sequence of the counters of all buttons corresponds to the sequence of three random generators and post an appropriate message in the message label
5. Repaint
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment