EE408 Fall 2009 Mid-Term Exam
15%
Due: 5
PM, Saturday November 7
This is a take-home mid-term exam which you must complete individually
between November 2 and 7.
There will be no classes on Monday and Wednesday of the week. During Friday's
lecture time, the instructor
will stay in Rowley 142 to answer any
clarification question about this exam.
All programming techniques tested here have been covered in the lab
exercises.
Knowledge for answering the questions here has been covered in the assignments
and lectures.
Verbatim copies of solutions, once detected, will result in serious
disciplinary treatment for all parties involved.
1. GUI Programming [10%]
Download and import into Eclipse the following project.
Open up the project in Eclipse's Package Explorer, you will notice two
directories, src and images. To make the application display images
properly, you need to add the images directory to the classpath of your
project as follows. In the Package Explorer view, select
Main_Frame.Java and right-click on it to pop up a context menu. Select
"Run As ..." menu and then "Run Configurations ..." (it may be "Run
..." on Windows), a dialog will pop up where you can configure your
project. In the tabbed pane in the dialog, pick "Classpath". Add the
images directory to the class path. (In the Classpath panel, (1) click
"User Entries" (2) click "Advanced ..." button from the right. A dialog
pops up. Select "Add Folders" and press OK. Another dialog pops up. (3)
Choose the images directory from the dialog.)
Initially, this project will produce a GUI similar to the picture in
the left below (after some operations). Complete
tasks 1a - 1h. In the end, you should get a GUI similar to
the picture in the right. Detailed
instructions for tasks 1a to 1h follow.

1a. "About ..."
Menu Item and Dialog [2%]
Add a menu "Help"->"About ..." ("Help" is the menu and "About ..."
is a menu item under "Help"). "About ..." should have character "h" as
mnemonic and "CTRL+h" as accelerator. [1%]
When "CTRL+h" is pressed, a dialog like what follows should pop up. You
can use any image for the popup dialog, but not the default ones
provided by Swing. [1%]

1b. "Specify
Identity ..." and Dialog [2%]
The second menu item in the Edit menu is "Specify Identity ...". When
this item is clicked or "CTRL+I" is typed, a modal dialog should pop up
where a student's names can be typed in. [1%] The dialog should look
like exactly the one shown below. In particular, the labels in the
dialog should be left-aligned, and the 3 textfields should also be
left-aligned.

Add a button for "Specify Identity ..." to the toolbar. [1%] This
button should behave consistently with the other two in the tool bar.
That is, it must have an icon, support rollover, and have a tooltip
text.
1c. Popup Menu [1%]
Add a popup menu to the frame. The popup menu should support three
actions, "Open Picture ...", "Specify Identity ...", and "Choose
Courses ...".
1d. Student
Information Panel [2%]
The student information panel is on the right-hand side of the first
picture shown above.
Rework it so that it is laid out, from top to bottom, as follows
- identity info. Insert a
label displaying a student's name in the format of "title+first
name+middle name+last name", e.g., "Mr. John Anderson Doe". [1%]
Initially, it should display "Name: No name specified".
- major. A label in the
format of "Major: major_specified", e.g., "Major: Software
Engineering". This is already done for you.
- course list. In the
program given to you, a label is used to show the list of chosen
courses. Use a scrollable list instead. [1%]
1f. Initial Positions and
Titles for Dialogs and Frames [1%]
All the dialogs you created must be positioned relative to the main
frame, not at (0, 0) or any default position. They should also
use a proper title.
1g. Coding Quality (free
of bugs) and Coding Style [2%]
If your program contained loads of bugs: 0; minor bugs: 1; no bugs
detected: 2.
You should properly use indentation and blank lines, comments, and
identifier names, for example, naming identifiers like this smallLetterForFirstWordButCapitalForRemainingWordsIsRecommended
(also known as Camel Case).
If signs of attention to style issue are detected from your code: 1; no
consideration of coding style: 0.
2. Questions [5%]
2a. Menus support two kinds of
keyboard alternatives: mnemonics and accelerators. Mnemonics offer a
way to use the keyboard to navigate the menu hierarchy, increasing the
accessibility of programs. Accelerators offer keyboard shortcuts to
bypass navigating the menu hierarchy. Only leaf menu items can have
accelerators. Mnemonics are for all users; accelerators are for power
users. [1%]
TRUE
FALSE
2b. GUI layout managers in
AWT/Swing determine automatically the sizes and positions of a
container and all the widgets inside the container. Developers can
control the layout process by choosing a suitable layout manager for a
container and setting proper minimum, preferred, and maximum sizes for
its child widgets. [1%]
TRUE
FALSE
2c. Which of the following is
the best choice for selecting one out of 12 months in a certain GUI
application? [1%]
A. A ComboBox
B. A List
C. A group of 12 radio buttons
D. A group of 12 Check boxes
2d. A first-year college
student is using a GUI application to select one or two electives out
of 35 possible courses. Which of the following is the best choice for
the application to display the 35 courses? [1%]
A. A ComboBox
B. A List
C. A group of radio buttons
D. A group of Check boxes
2f. A large engineering product
retailer groups its products into 35 categories. A GUI application is
provided to its customers to assist them in preparing purchase orders,
where each product category requires a panel to display its own
category-specific content. It is known that many customers prefer
to alternate between seeing the full list of product categories and
investigating a particular category in detail. Which of the following
design alternatives is the best for this task? [1%]
A. A TabbedPane
B. A new dialog with a ComboBox on top for the 35 categories, and a
panel below for displaying the content of the selected category.
C. A new dialog with a list displaying the 35 categories at left and a
content panel at right.
D. A new dialog with a spinner on top for the 35 categories, and a
panel
below for displaying the content of the selected category.
3. Bonus Task [1%]
Support multiple instances of the top-level frame so that multiple
worksheets can be created and prepared at the same time. [1%]
Deliverables
Note: please read and follow the following instructions carefully
as it will help speed up the grading process.
- Rename your project to "midterm-initital+last name". For example,
a project from the instructor should be named "midterm-dhou".
- Export your project as a zip file.
- Send me an email with the subject "EE408 Midterm: your name",
with the zip file as attachment and your answers to question 2 as the
main text. If you have worked out the bonus task, say so in the email.
- Optionally (meaning that answering them or not will have zero
impact on your midterm grades), you may include, in the main text,
comments to the following two questions:
Describe items which you have liked the best so
far in the instructor's teaching.
Describe a single most important item which you would like to see the
instructor change in the remaining time of EE408.