System, but they may not be reproduced for publication



Yüklə 83 Mb.
Pdf görüntüsü
səhifə78/82
tarix19.04.2023
ölçüsü83 Mb.
#106251
1   ...   74   75   76   77   78   79   80   81   82
Java A Beginner’s Guide, Eighth Edition ( PDFDrive )

lightweight.
2.
Can the look and feel of a Swing component be changed? If so, what feature enables
this?
Yes. Swing’s pluggable look and feel is the feature that enables this.
3.
What is the most commonly used top­level container for an application?


JFrame
4.
Top­level containers have several panes. To what pane are components added?
Content pane
5.
Show how to construct a label that contains the message "Select an entry from the
list".
6.
All interaction with GUI components must take place on what thread?
event­dispatching thread
7.
What is the default action command associated with a JButton? How can the action
command be changed?
The default action command string is the text shown inside the button. It can be
changed by calling setActionCommand( ).
8.
What event is generated when a push button is pressed?
ActionEvent
9.
Show how to create a text field that has 32 columns.
10.
Can a JTextField have its action command set? If so, how?
Yes, by calling setActionCommand( ).
11.
What Swing component creates a check box? What event is generated when a check
box is selected or deselected?
JCheckBox creates a check box. An ItemEvent is generated when a check box is
selected or deselected.
12.
JList displays a list of items from which the user can select. True or False?
True


13.
What event is generated when the user selects or deselects an item in a JList?
ListSelectionEvent
14.
What method sets the selection mode of a JList? What method obtains the index of
the first selected item?
setSelectionMode( ) sets the selection mode. getSelectedIndex( ) obtains the
index of the first selected item.
15.
Add a check box to the file comparer developed in 
Try This 16­1
that has the
following text: Show position of mismatch. When this box is checked, have the program
display the location of the first point in the files at which a mismatch occurs.




16.
Change the ListDemo program so that it allows multiple items in the list to be
selected.




A
Appendix B
Using Java’s Documentation Comments
s explained in 
Chapter 1
, Java supports three types of comments. The first two are the
// and the /* */. The third type is called a documentation comment. It begins with the
character sequence /**. It ends with */. Documentation comments allow you to embed
information about your program into the program itself. You can then use the javadoc
utility program (supplied with the JDK) to extract the information and put it into an
HTML file. Documentation comments make it convenient to document your programs.
You have almost certainly seen documentation that uses such comments, because that
is the way the Java API library was documented. Beginning with JDK 9, javadoc
includes support for modules.
THE JAVADOC TAGS
y
History
Topics
Tutorials
Offers & Deals
Highlights
Settings
Support
Sign Out


THE JAVADOC TAGS
The javadoc utility recognizes several tags, including those shown here:
Document tags that begin with an “at” sign (@) are called stand­alone tags (also called

Yüklə 83 Mb.

Dostları ilə paylaş:
1   ...   74   75   76   77   78   79   80   81   82




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə