Java Reference
In-Depth Information
SR 11.20
A mnemonic is a character that can be used to activate a control
such as a button as if the user had used to mouse to do so. The user
activates a mnemonic by holding down the ALT key and pressing the
appropriate character.
SR 11.21
A component should be disabled if it is not a viable option for the user
at a given time. Not only does this prevent user error, but also it helps
clarify what the current valid actions are.
SR 11.22
The class(es), and the line(s) of code from the class(es), that provide
the listed functionality are:
a.
LightBulb − panel.setBackground (Color.black)
b.
LightBulbControls - offButton.setToolTipText (
"
Turn it
off!")
c.
LightBulbControls - onButton.setMnemonic ('n')
OffListener - onButton.setEnabled (true)
d.
OnListener - onButton.setEnabled (false)
e.
LightBulbPanel − on = true
11.8
Combo Boxes
SR 11.23
A combo box is a component that allows the user to choose from a
set of options in a pull-down list. An editable combo box also allows
the user to enter a specific value.
SR 11.24
The
JukeBox
program ensures that it doesn't try to play a song associ-
ated with the
"Make a Selection. . ."
combo box option by setting
the corresponding entry in the
music
array to
null
.
SR 11.25
There are two action listeners defined in the
JukeBox
program. The
ComboListener
listens for a mouseclick on the combo box selection
list. The
ButtonListener
listens for a mouseclick on one of the two
buttons (play and stop).
SR 11.26
The
JukeBox
program associates the combo box selection made by the
user with a specific audio clip by storing the audio clips in an array
music
; storing the descriptions of the music, in the same order, in an
array
musicNames
; generating the combo box used to make music selec-
tions based on the array
musicNames
; and using the index returned from
a combo box selection to set the current audio clip from the
music
array.
11.9
Scroll Panes
SR 11.27
A scroll pane can have a vertical scroll bar on the right side and/or a hor-
izontal scroll bar along the bottom. The programmer can determine, in
Search WWH ::
Custom Search