- Read the rules for this exam.
- Implement and test a new project called Exam2Retest that implements this UML class diagram, Stage 1.
Grading rubric — 10 points, as follows: 5 points if the tool tips work, 5 points if everything else works.
But no points if you do not follow the UML class diagram, Stage 1.
- Implement and test the addition of a single LightGrayPanel (PANEL, not button!)
to the CyanPanel as described in this UML class diagram, Stage 2.
- The new part of the UML for this stage is shown in gray in the above diagram.
- Here is what your project should look like after completing this step :
- Per the UML, clicking the LIGHT_GRAY panel once should change its color to RED unless it already was RED, in which case its color should change to LIGHT_GRAY.
- So repeated clicking toggles the LIGHT_GRAY panel's color back and forth between RED and LIGHT_GRAY.
- Per the UML, a LightGrayPanel should be LIGHT_GRAY initially and its preferred size should be 50 by 50.
Grading rubric — 15 points, as follows: 3 points if the panel appears as specified, 12 points if it acts as specified.
But no points if you do not follow the UML class diagram, Stage 2.
- Revise your project so that:
- Instead of a single LightGrayPanel,
the CyanPanel displays 40 LightGrayPanel's
(each of which acts just like the LightGrayPanel described in the previous problem).
-
Furthermore,
clicking the mouse anywhere in the CyanPanel (except on a LIGHT_GRAY subpanel) should cause ALL the LightGrayButton's
on the CyanPanel to change their color as if they had just been clicked themselves.
- Here is the UML class diagram, Stage 3, updated for this step,
with the new part of this stage shown in gray.
- Here is what your project should look like:
Grading rubric — 25 points, as follows:
5 points if clicking the mouse toggles the color of at least one of the LIGHT_GRAY panels,
20 more points if clicking the mouse toggles the color of ALL of the LIGHT_GRAY panels on the CyanPanel.
- Also, reduced score if you do not follow the UML class diagram, Stage 3.
- Good style demands that changing the number of buttons from 40 to something else should mean changing ONE number in the program, -10 if you don't.
- Good style demands that here you use an ArrayList instead of an array, -10 if you don't (and -20 if neither ArrayList nor array).
- Good style demands that any ArrayList you use be parameterized (ie.. uses the angle-bracket notation) appropriately, -5 if it does not.
- Implement and test the following (partial credit is available):
- A BluePanel class and WhitePanel class
as described in this UML class diagram, Stage 4.
- A BluePanel is on the PinkPanel, and a WhitePanel is on the BluePanel.
- The BluePanel is blue and is 100 x 100 (not 50 x 50). The WhitePanel is WHITE.
- Every YellowPanel should have a new LightGrayPanel
(so a single LightGrayPanel shows up in the LEFT YellowPanel, and a single LightGrayPanel shows up in the RIGHT YellowPanel).
- The WhitePanel in the BluePanel has-a the sole LightGrayPanel in the LEFTMOST of the two YellowPanel's.
- Clicking the WhitePanel does ALL of the following:
- It behaves like a LightGrayPanel
(i.e. clicking on the WhitePanel changes its color to RED unless it already is RED,
in which case clicking on the WhitePanel changes its color to LIGHT_GRAY).
- Additionally, clicking on the WhitePanel changes the background color of the CyanPanel to GREEN. (Don't bother to change the Tool Tip.)
- Additionally, clicking on the WhitePanel causes the sole LightGrayPanel in the LEFTMOST YellowPanel to behave as if it were clicked
(i.e., it changes its color to RED unless it already is RED,
in which case it changes its color to LIGHT_GRAY).
The new part of the UML for this stage is shown in gray in that diagram.
Here is what your project should look like after completing this step:
Grading rubric — 30 points, as follows:
- 10 points if clicking the WhiteButton changes its color as specified (but NO points if this is NOT through inheritance)
- 10 points if clicking the WhiteButton changes the background color of the CyanPanel to GREEN (and is implemented per the UML).
- 10 points if clicking the WhiteButton changes the background color of the sole LightGrayPanel in the LEFTMOST YellowPanel as specified
(but no points if not through a direct has-a relationship).
- Implement and test the addition of a single JButton to the PinkPanel,
where the JButton responds to itself via an anonymous class
by changing its text to "goodbye".
- Make the JButton be ORANGE, so that I can easily tell which one it is.
- The new part of the UML for this stage (Stage 5) is shown in gray in that diagram.
Here is what your project should look like after completing this step:
Grading rubric — 10 points, as follows: 10 points if the button responds to itself successfully via an anonymous class, else no credit.
- Implement and test the addition of a BlackPanel to EVERY YellowPanel as described in this UML class diagram, Stage 6.
- Per the UML, every BlackPanel should behave by itself as if it is clicked every five seconds (approximately) (with the first "click" 5 seconds after the program starts).
- Clicking a BlackPanel should have the same effect that clicking a LightGrayPanel does:
the BlackPanel turns RED unless it already is RED, in which case it turns LIGHT_GRAY.
- A BlackPanel should be BLACK.
- The new part of the UML for this stage is shown in gray in that diagram.
- Here is what your project should look like after completing this step:
Grading rubric — 10 points if the BlackPanel behaves as specified.
- Turn in your work by committing your Exam2Retest project to your individual repository: