Errata for
The Java Class Libraries: Second Edition, Volume 2
by
Patrick Chan and Rosanna Lee
If you find an error in the book,
please check this list first to see if it is already known.
If not, please mail us the relevant
information, including page numbers.
All errata will be fixed in the next possible printing.
The errata is categorized by the printing number of the book.
You can tell which printing you have by looking at the
bottom of the copyright page. The last line of that page
indicates the printing number.
Errata for First to Sixth Printings
GridBagConstraints
- Page 738
-
The description for Size should read:
The gridbag is divided into rows and columns of cells.
A component can span more than one column or row.
The size constraint specifies the height and width of a component
in terms of the cells that it occupies.
See gridwidth later in this section
for an example of how to set and change the height and width of a component.
List.isIndexSelected()
- Page 998
-
isItemSelected() should be isIndexSelected().
This change affects the method title and the SYNTAX section.
MediaTracker.checkID()
- Page 1022
-
Delete the verify paragraph in the PARAMETERS section.
There is no verify parameter in this method.
Errata for First to Third Printings
Applet.getImage()
- Page 85
-
Change the second sentence of the DESCRIPTION section to:
"If name is specified, the image is fetched from
a new URL created using name relative to the URL url."
In the PARAMETERS section, change the description of name to
"The non-null URL string relative to url."
AWTEventMulticaster
- Page 128
-
Add a USAGE subsection to the DESCRIPTION section as follows:
Usage
This class is used internally by the AWT components to register
listeners and to dispatch events to listeners.
It can also be used by user-defined components to do the same if
those components fire the events defined in the java.awt.event
package. See the class example.
Components that fire new events with corresponding new event listeners
need to use a subclass of AWTEventMulticaster that has
the appropriate add()/remove() methods
for the new event listener(s).
The subclass should also have additional methods for dispatching the
new events to the corresponding listeners.
For example, the AWTEventMulticaster class defines
the methods focusLost() and focusGained()
for dispatching a FocusEvent to registered listeners.
BorderLayout.addLayoutComponent()
- Page 179
-
null is not a valid value for the location parameter.
location can only be one of NORTH, SOUTH,
WEST, EAST, or CENTER.
The DESCRIPTION and PARAMETERS sections should be updated accordingly.
Component.setBackground()
- Page 383
-
Remove the last paragraph from the DESCRIPTION section.
This is the paragraph starting with the phrase "If this component
is already displayed".
Font.decode()
- Page 643
-
Remove the last paragraph from the DESCRIPTION section.
This is the paragraph starting with the phrase "If the system property
propName".
Graphics.drawString()
- Page 712
-
In the sample code in the DESCRIPTION section,
there is a missing close parenthesis after fm.getAscent().
The code should read:
drawString(string, p.x, p.y+fm.getAscent());
ImageObserver
- Page 831, 834, 835
-
In the third sentence of the first paragraph of the Description section,
Image.drawImage() should be Graphics.drawImage().
In the DESCRIPTION and SEE ALSO sections of ALLBITS and
FRAMEBITS,
Image.drawImage() should be Graphics.drawImage().
TextComponent.getSelectionEnd()
- Page 1434
-
The window title in the screen shot in Figure 354 should
read "getSelectionEnd" instead of "getSelectedEnd".
TextComponent.getSelectionStart()
- Page 1435
-
The window title in the screen shot in Figure 355 should
read "getSelectionStart" instead of "getSelectedStart".
Errata for First and Second Printings
Applet
- Page 81-82
-
In the class example, in the init() method just before
resize() is invoked, add the following two lines:
addMouseListener(new MouseEventHandler());
addMouseMotionListener(new MouseMotionEventHandler());
And add the modifier public to the class definitions of
MouseEventHandler and MouseMotionEventHandler.
These changes fix the problem of the applet not responding to mouse events.
CheckboxGroup.getSelectedCheckbox()
- Page 237
-
The SYNTAX section should read
-
public Checkbox getSelectedCheckbox()
Color
- Page 284
-
Replace the last sentence in the first paragraph of the DESCRIPTION
section of the Color constructor with the following:
-
-
In JDK 1.1.x, if an integer is larger than 255,
an IllegalArgumentException is thrown.
In JDK 1.0.x, if an integer is larger than 255,
only the lower 8 bits are used.
Frame.dispose()
- Page 671
- In the EXAMPLE section,
btnDispose.setEnabled(true);
should read
btnDispose.setEnabled(false);
Image.flush()
- Page 802
-
The first sentence in the first paragraph on the page should read:
-
Explicitly calling flush() is not necessary, since
the resources are disposed when the image object is reclaimed
by the garbage collector.
List.getItemCount()
- Page 993
-
In the SYNTAX section, getItemCounts() should be getItemCount().
TextAreaPeer
- Page 1425-1426
-
DEPRECATED tags are missing for the methods
insertText(),
preferredSize(),
and
replaceText().
TextField.setEchoChar()
- Page 1466
-
Change the last word in the DESCRIPTION section
from true to false. The sentence should read:
-
-
After the echo character is set to 0, the characters in the
text field will be visible and echoCharIsSet()
will return false.
WindowAdapter
- Page 1535
-
In the last line of the page, under the EXAMPLE section,
change WindowEvent to Dialog.
Errata for First Printing
Dialog.isModel()
- Page 514
-
Delete the sentence in the DESCRIPTION section that says
the modal property can only be set by constructor. The modal property
can be changed using setModal().
FileDialog
- Page 604
-
The class example has extraneous declaration.
Delete the declaration of fd in the actionPerformed() method.
FontMetrics
- Page 653
- In Figure 141, height should also include
leading.
Graphics.drawImage()
- Page 700
- Delete "Color bgColor," from
the fifth prototype of drawImage().
ImageObserver.imageUpdate()
- Page 349
- Page 836
- Page 1024
-
In Component.imageUpdate(), ImageObserver.imageUpdate(),
and MediaTracker.imageUpdate(),
change the RETURNS section from
-
-
true if no further calls to imageUpdate() are needed.
-
to
-
-
-
true if further calls to imageUpdate() are needed.
Window.Window()
- Page 1533
-
Delete the last two sentences in the EXAMPLE description. The popup
is created modeless, as described in the method description on page
1532. However, PopupWindow.MouseEventHandler is still necessary
to dispose of the popup window when multiple popups are created
as the result of two consecutive mouse downs with no
intervening mouse release. This can occur for example when the parent window
is resized and the mouse release occurs outside of the parent window.
This behavior is easier to reproduce on a Windows machine.
This page was updated: 6-Jul-2000