Reference: Chapter 5 of the Swing Tutorial book
The assignment: Extend the MultiListener program to have a third button and a third text area. Here are the details: The third button should be labeled "I hear you!", the third text area, EavesDropper2, should record events (simply printing out the actionCommand as in the other cases) from both that button and the "You don't say!" button. The top text area (MultiListener) should also get events from the third button. To summarize:
For example, if you clicked the buttons "Blah blah blah", "You don't say!", and "I hear you!" in that order, you should see something like:
-------------------------------------------------------- |What MultiListener hears: | -------------------------------------------------------- |Blah blah blah | |You don't say! | |I hear you! | | | | | -------------------------------------------------------- |What EavesDropper hears: | -------------------------------------------------------- |You don't say! | | | | | | | -------------------------------------------------------- |What EavesDropper2 hears: | -------------------------------------------------------- |You don't say! | |I hear you! | | | | | -------------------------------------------------------- | Blah blah blah | | You don't say! | | I hear you! | --------------------------------------------------------Notes: the layout is not important in this program - you can use the GridBagLayout if you want, but you can use another layout if it is easier. Also, you may need to define a new class and/or make some objects (more) global.
Here is the code for the: MultiListener program file.
What to turn in:
Turn in the following items from the
Computer Science Lab Report Format:
1. (1 point) The Basic Information (your name, class, section,
TA's name, assignment number, and date) can be on a separate cover sheet or as
(highlighted) comments at the top of your main program file.
11. (4 points) Include the program listings.
This listing should show good style,
be appropriately commented, have the important/new parts
highlighted, and include handwritten explanations if it helps the
reader's understanding of the code.
13./14. (5 points)
Do a demo of your modified program for the TA that demonstrates that
the program works correctly.