Java Swing

Errata for Java Swing

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page xxiii
paragraph 3: Replace with

One significant problem we've faced is Sun's waffling on the Swing package names. Swing was first released in the com.sun.java.swing package hierarchy, which was supposed to be a temporary resting place. With JDK 1.2, Swing was supposed to move into the java.awt.swing hierarchy. For some reason, Sun backed off, and kept Swing in the com.sun hierarchy for beta 4. They then moved it to javax.swing for the first official release of JDK 1.2--except for a few oddball platform-specific packages (like the Windows look-and-feel) that remain in com.sun. We've been at our wit's end trying to fix the package names, both in the book and in the online source files. At any rate, for JDK 1.2 and Swing 1.1 (for use with JDK 1.1), the major Swing classes are in the following packages:

Anonymous    Dec 01, 1998
Printed
Page xxiii
add this footnote at the end of the 3rd paragraph, after

all the other changes: "The latest rumor is that Sun will rechristen JDK 1.2 when the final official release occurs--it will probably be called Java 2."

Anonymous    Dec 01, 1998
Printed
Page xxiv
para 2 (description for com.sun.java.swing.plaf--which,

according to the new rules, will become javax.swing.plaf): replace with: "Classes supporting "pluggable look-and-feel", including classes that implement the Metal and Multi look-and-feels. (Implementations of the Windows and Motif L&Fs are packaged under com.sun.java.swing.plaf.) Covered in Chapter 26, Look & Feel."

Anonymous    Dec 01, 1998
Printed
Page xxiv
About the Source Code: Add at the end of the section

"The examples are available as a JAR file, a ZIP archive, and as a compressed TAR archive. The files named swing-old use the old (com.sun) package hierarchy, and have been tested against JDK 1.2 beta 4. The files named swing have been converted to the new (javax) package hierarchy, and have been tested against JDK 1.2 Release Candidate 1."

Anonymous    Dec 01, 1998
Printed
Page 6
In the note, the last phrase should be "parts of which only work

on the Windows platform."

Anonymous    Dec 01, 1998
Printed
Page 7
para. 2 add "several" to read "Swing is capable of emulating

several look-and-feels, ..."

Anonymous    Dec 01, 1998
Printed
Page 11
paragraph describing com.sun.java.accessibility (which will

become javax.accessibility): Delete sentence beginning "In addition, you can also..."

Anonymous    Dec 01, 1998
Printed
Page 11
Delete sentence "The package names may change to javax.swing

in the future."

Anonymous    Dec 01, 1998
Printed
Page 11
modify footnote: replace "and now has...the actual release"

with "and is using the javax.swing hierarchy for the actual release of JDK 1.2." Also to the footnote on page 11, after all the other changes are made, add "Sun provides a free tool for automatically adjusting the package names in any code you've written for earlier releases. For more information, see http://java.sun.com/products/jfc/PackageRenamer/.

Anonymous    Dec 01, 1998
Printed
Page 12
last sentence under javax.swing.plaf: Modify the sentence to

read: "Concrete implementations of the windows and motif L&Fs are in subpackages of com.sun.java.swing.plaf." (This is the exception to the rule.)

Anonymous    Dec 01, 1998
Printed
Page 12
para. 4 (description of com.sun.java.swing.plaf): Add to the

end: "(Concrete implementations of the Windows and Motif L&Fs are in subpackages of com.sun.java.swing.plaf.)"

Anonymous    Dec 01, 1998
Printed
Page 12
para. 5 (description of com.sun.java.swing.preview): Delete.

Anonymous    Dec 01, 1998
Printed
Page 19
para. 3, "To see why, romember...": "romember" changed to "remember"

Anonymous    Dec 01, 1998
Printed
Page 20
before "after downloading" add: "Assuming you're using JDK

1.1..." Also, before "you should immediately", add: "If you're using JDK 1.2, just find the directory demo/SwingSet (unfortunately, it's moved around in different pre-releases) and type java SwingSet."

Anonymous    Dec 01, 1998
Printed
Page 35
In the code example,

JLayeredPane desktop; Should be JDesktopPane desktop;

Anonymous   
Printed
Page 40
in the code: indent line 10 ("implements...") two spaces.

Anonymous    Dec 01, 1998
Printed
Page 58

Table 3-5: The default value for the "visible" property now reads : "true", not "false".

Anonymous    May 01, 1999
Printed
Page 92
In the code, "c.add(la^bel2);" was changed to "c.add(label2);"

Anonymous    May 01, 1999
Printed
Page 95
Last paragraph, first sentence

"imageHeight and imageWidth" has been changed to: "iconHeight and iconWidth" (Retaining the constant-width font.)

Anonymous    Jan 01, 1999
Printed
Page 151, 152
Replaced the line starting with the final for() loop with the

following code: for (int i = MY_MINIMUM; i <= MY_MAXIMUM; i++) { final int percent=i; try { SwingUtilities.invokeAndWait( new Runnable() { public void run() { it.updateBar(percent); } }); java.lang.Thread.sleep(100); } catch (Exception e) {;} } After this segment, there should be two curly braces remaining in the example-- one which closes off the main() function, and one which closes off the class itself.

Anonymous    May 01, 1999
Printed
Page 169
model = new DefaultListModel ()

list = new JList (); should read: model = new DefaultListModel (); list = new JList (model);

Anonymous    Dec 01, 1998
Printed
Page 188
The final JList constructor should be

public JList(Vector vector) Creates a JList using a Vector of objects passed in to populate the data model. The contents of the list will be the result of calling toString() on each element in the Vector.

Anonymous   
Printed
Page 236

2.1 now reads: public static final int MAYBE_EXIT_ON_CLOSE ==101; It should be (no second equals sign): public static final int MAYBE_EXIT_ON_CLOSE = 101;

Anonymous    May 01, 1999
Printed
Page 247
end of the first paragraph, add a footnote:

"The appearance of an internal frame in the Metal look-and-feel has changed very slightly since these screen shots were taken." (Use same footnote for p. 561)

Anonymous    Dec 01, 1998
Printed
Page 313
In the sentence that begins "The validateRoot property is

always true to ensure that revalidation...", whoch should be which.

Anonymous   
Printed
Page 317
Under the getScrollableUnitIncrement description: "The unit

increment specifies how to display the next logical row or column; the bolck increment specifies...", bolck should be block.

Anonymous   
Printed
Page 437

Under The MenuDragMouseListener Interface, it reads: public abstract void menuDragMouseDragged(PopupMenuEvent e) Called when the mouse has been dragged inside of a menu item. public abstract void menuDragMouseReleased(PopupMenuEvent e) Called when the mouse has been released inside of a menu item. public abstract void menuDragMouseEntered(PopupMenuEvent e) Called when the mouse is being dragged, and has entered a menu item. public abstract void menuDragMouseExited(PopupMenuEvent e) Called when the mouse is being dragged, and has exited a menu item. It should read: void menuDragMouseDragged(MenuDragMouseEvent e) Called when the mouse has been dragged inside of a menu item. void menuDragMouseReleased(MenuDragMouseEvent e) Called when the mouse has been released inside of a menu item. void menuDragMouseEntered(MenuDragMouseEvent e) Called when the mouse is being dragged, and has entered a menu item. void menuDragMouseExited(MenuDragMouseEvent e) Called when the mouse is being dragged, and has exited a menu item.

Anonymous   
Printed
Page 480
The import statement in the example should be

import javax.swing.*; ...to reflect the latest package names, and the getContentPane().add() method should be to follow our "standard" of using setContentPane() when there is only one component to add: setContentPane(jsp);

Anonymous   
Printed
Page 496
In the first line below the Properties table, "whic h"

should be "which".

Anonymous   
Printed
Page 496
First sentence under Table 15-6: "whic hcould" now reads"which could"

Also, in the following sentence: "rande of rows" was changed to "range of rows"

Anonymous    May 01, 1999
Printed
Page 501
In the last method described, almost at the bottom of the page

"public setValueAt( Object balue," should be "value"

Anonymous   
Printed
Page 510
The code

// Now we must rebuild the headers array with the new column names headers = new String[ colCount ]; for( int i = 1; h <= colCount; h++ ) { headers[ h ] = meta.getColumnName( h ); } Arrays start at 0 therefore the line 'headers[ h ] = meta.getColumnName( h )' should be // Now we must rebuild the headers array with the new column names headers = new String[ colCount ]; for( int i = 1; h <= colCount; h++ ) { headers[ h-1 ] = meta.getColumnName( h ); ^^ }

Anonymous    Dec 01, 1998
Printed
Page 515
In the middle of the JTable Constants table, in the description of

AUTO_RESIZE_NEXT_COLUMN ! end of first line "netx" should read "next"

Anonymous   
Printed
Page 515
Table 15-2, 3rd row, 3rd column: The word "netx" now reads "next"

Anonymous    May 01, 1999
Printed
Page 515
Table 15-2, 5th row, 3rd column: The word "proesrve" now reads "preserve"

Anonymous    May 01, 1999
Printed
Page 518
In the middle of the page, public Compinent should read Component

Anonymous   
Printed
Page 526
Under the heading "Inner Classes," "bublic" should read "public"

Anonymous   
Printed
Page 563
First code example:

add(messageLabel, BorderLayout.SOUTH); Should read: getContentPane().add(messageLabel, BorderLayout.SOUTH);

Anonymous   
Printed
Page 686

It now reads: // Remove an UndoableEditListener using our support object. public void removeUndoableEditListener(UndoableEditListener l) { support.AddUndoableEditListener(l); } Should read: // Remove an UndoableEditListener using our support object. public void removeUndoableEditListener(UndoableEditListener l) { support.removeUndoableEditListener(l); }

Anonymous   
Printed
Page 714

2nd to last paragraph; last sentence should read: "...subclass JTextArea and override isManagingFocus() to return false." This instead of "getManagingFocus()"

Anonymous    Dec 01, 1998
Printed
Page 722
bottom of Table 19-7: Delete dot before JTextComponent.

Anonymous    Dec 01, 1998
Printed
Page 903
Within getViewAtPosition() method: use "entry"

...contains the View's allocation on entry and is constrained to the child's View on exit....

Anonymous   
Printed
Page 943
add footnote after "HTML package has stabalized."

"As of JDK 1.2 beta4, HTMLEditorKit looks more stable, but we're still not convinced it's cooked." (HTMLEditorKit is constant width)

Anonymous    Dec 01, 1998
Printed
Page 995
Put the "u" in "updateWindow(comp);" under the "t" in "timer".

Anonymous    Dec 01, 1998
Printed
Page 1004
1st sentence: Add footnote after "package":

"Note that the Windows and Motif look-and-feels remain in the com.sun.java.swing.plaf package hierarchy."

Anonymous    Dec 01, 1998
Printed
Page 1014
code, line 4: indent this line so that the "c" in com.sun

is under the "M" in UIManager. (Note that in this case, com.sun.java.swing.plaf.motif does NOT change.)

Anonymous    Dec 01, 1998
Printed
Page 1017
para. 1: eliminate "beta 4" from the directory names; i.e.,

"/usr/local/jdk1.2/" and "/usr/local/jdk1.2/jre/lib/swing.properties".

Anonymous    Dec 01, 1998
Printed
Page 1080
Table 27-6: Add a line under the table header.

Anonymous    Dec 01, 1998
Printed
Page 1100
Bottommost source code excerpt, 5th line of code should be

if (list[index]==ChangeListener.class) { Also, the index was updated to reflect the new package names entered in the reprint. The new index is available via the "Index" link from the book's Web page, http://www.oreilly.com/catalog/9781565924550.

Anonymous    Dec 01, 1998
Printed
Page 1119

In the section heading Managing Focus, the 3rd sentence used to read: Instead it should let the events fall through to the processComponentKeyEvent() method (and inevitably to the processComponentKeyEvent() method) inside your own component. It now reads: Instead, it should let the events fall through to JComponent's processComponentKeyEvent() method, or more accurately, to the overriden processComponentKeyEvent() method inside your own component.

Anonymous    May 01, 1999
Printed
Page 1136
End of first paragraph - the closing parenthesis was deleted.

Anonymous    Dec 01, 1998