Java Swing, 2nd Edition by David Wood, James Elliott, Marc Loy, Robert Eckstein, Brian Cole This errata page lists errors outstanding in the most recent printing. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated Sept. 8, 2006. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: (43) 1st line; Reference to Table 3-2 should be 3-1. (74) code sample, center page; exampleButon.getActionMap().put("download",exampleAction); exampleButton.getInputMap(WHEN_IN_FOCUSED_WINDOW).put( KeyStroke.getKeyStroke("F8"),"download"); The first variable should be named "exampleButton" not "exampleButon" (81) 3/4 of the way down the page; "public KeyStroke[] keys" should be "public KeyStroke[] keys()" {166} Table 7-2; Table 7-2 lists the property elementAt as an indexed property with a bullet under the "set" column. Although there is a setElementAt(Object obj, int index) method on DefaultListModel, this is not the signature of a setter for an indexed property and you cannot use reflection on elementAt with an indexed write method. The bullet under the set column should be removed for elementAt. It seems other tables correctly show this situation such as Table 7-12, page 196, as an example. AUTHOR: The reader is correct. The proper method signature would be setElementAt(int, Object). The bullet should be removed, although I would note in the errata that both of the following methods are available for setting the value of a particular element: public void setElementAt(Object elem, int index); public void set(int index, Object elem); We probably should have footnoted that fact... (227) code example, middle of the page; the closing curly brace is indented a few spaces. very minor formatting problem. "... getContentPane().add(notOpaque); }" Should be: "... getContentPane().add(notOpaque); }" {233} GlassExample.java There is an updated version of the GlassExample available at - http://examples.oreilly.com/jswing2/code/ch08/newglass.zip This fixes two bugs: 1) Key events were not supressed in the original example, they are now 2) On 1.2 and 1.3 systems, first mouse click after removing glass pane would not be sent to the component under the mouse. This was a bug in the way JRootPane handled the glass pane component that has been fixed in the 1.4 release. FixedGlassPane.java (see below) provides a workaround for 1.2 and 1.3, but is still safe to use with 1.4. The updated files are: GlassExample.java Updated to use (and control) the new glass pane FixedGlassPane.java Extension of JPanel that allows for redispatching erroneous events to their rightful owners (323) Table 11-3; The JScrollPane properties "columnHeader" and "rowHeader" has "set"-methods missing. Both properties should have a bullet in the "set" column. [491] Figure 15-2 JTable class diagram; In the upper right box (javax.swing.event), you state that JTable implements: TableModelListener (1st occurence) TableColumnModelListener, TableModelListener (2nd occurence) TableModelListener (3rd occurence) According to the Java 1.4.2 API: the box (javax.swing.event) should state that JTable implements: TableModelListener TableColumnModelListener ListSelectionListener CellEditorListener {583} 1st paragraph; "The toggleClickCount property allows you to specify how many clicks are required to start editing a tree node." should read: "The toggleClickCount property allows you to specify how many clicks trigger an action on a tree node. If that node is a leaf and the tree is editable, it will start the editing process. For non-leaf nodes (folders), the appropriate number of clicks will expand or collapse the node." (924) 1st paragraph (line 1); "The component and ropTarget properties are both...." should be: "The component and dropTarget properties are both...." (956) Comments for TreeDragSource.java; The comment for TreeDragSource.java includes the words "This is the Drop half." They should read: "This is the Drag half." (956) IN PRINT: right before code example; Text reads "Don't worry too much about the TransferableTreeNode class (we discuss this in greater detail in the next section)." The class is never described or defined in the "next section" or the rest or the chapter (or in any other), and can only be found on the website. AUTHOR: True. The code is online, but the discussion of it is indeed missing from the book. An explanation should be included in future reprints/editions of this book. {1010} 3rd paragraph; With J2SE SDK 1.4, the MacMetrics jar file contains classes that were compiled in the default package. As such, they will only work with your application if it, too, resides in the default package. Regrettably, we have neither the source nor the permission to alter the jar file. A simple launching application written as part of the default package however, should be able to bootstrap larger applications during development. (1076) in enumeration, key word "Tooltips"; Tooltips The ToolTipManager and JToolTip classes The name of the class is ToolTipManager with a capital T for Tip. (1126) 2nd paragraph; "...inside a container in whi'ch pop ups are used?" should read: "...inside a container in which pop ups are used?"