Java Reference
In-Depth Information
TextField
components
invisible Panel to
organize TextArea
components
Choice
component to add
drop-down list
Frame
with title bar
TextArea
components
to represent
rooms
invisible Panel to
organize input
components
invisible Panel
to place Button
component
Button component
FIGURE 5-3
Checkbox
components in
CheckboxGroup
Two TextField components are appropriate for input of the customer's name
and phone number, as they allow users to enter short pieces of data and perform
minor editing such as backspacing, cutting, and pasting.
Because the number of guests in a party is a specific number from 8 to 20,
the interface should include a drop-down list of valid numbers, rather than ask-
ing the user to type in the number. Providing a drop-down list not only will
ensure that a user enters a valid number, it also will allow the user to enter the
data more quickly. The Choice component , which displays as a drop-down list
in a graphical user interface, has methods for creating a list of data items and
methods to retrieve and reset the user's selection from the list.
Two Checkbox components in a CheckboxGroup are used to create
nonsmoking and smoking option buttons in the interface. Recall that Java uses
a CheckboxGroup for mutually exclusive selections. A hidden Checkbox compo-
nent will be used to clear the other option buttons after a room is booked so that
the option buttons are clear for entry of the next room reservation.
Finally, a Button component is used to create a button that the user clicks
to trigger the booking of each room. After a room is booked, the TextArea
component is set to a background color of light red and displays the customer
information.
Search WWH ::




Custom Search