Java Foundation Classes in a Nutshell by David Flanagan This errata page lists errors outstanding in the most recent printing. If you have any error reports or technical questions, you can send them to booktech@oreilly.com. (Please specify the printing date of your copy.) This page was last modified on July 11, 2001. Here's the 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: (xiii) Second paragraph; The second sentence reads: "Jeanette Hung, of Sun Microsystems;" It should be changed to: "Jeannette Hung, of Sun Microsystems;" {6,45,48,51,53,105,107,119} All application examples; Although not strictly an error, the code does not include a WindowListener to shut down the JVM when the application's window is closed: frame.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { System.exit(0); } }); {26} 2nd paragraph; The third sentence reads: To display formatted text, simply specify a string of HTML text that begins with an tag. It should be changed to: To display formatted text, simply specify a string of HTML text that begins with an tag." {32} Middle of the page; the code block under "Keyboard Actions" reads: KeyStroke up = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP); KeyStroke down = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN); KeyStroke pgup = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_PAGE_UP); KeyStroke pgdown=KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_PAGE_DOWN); It should read: KeyStroke up = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP, 0); KeyStroke down = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN, 0); KeyStroke pgup = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_PAGE_UP, 0); KeyStroke pgdown=KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_PAGE_DOWN, 0); Additionally, in the "panel" lines that follow this code, JComponent.WHEN_ANCESTOR_OF_FOCUSED_WINDOW should be changed to: JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT This occurs 4 times. [43] The code at the top of this page; The code currently looks like this: public void saveAs() { JFileChooser chooser = new JFileChooser(); int result = chooser.showSaveDialog(mainpane); if (result == JFileChooser.APPROVE_OPTION) save(chooser.getSelectedFile()); } It should be changed to look like this: public void saveAs() { JFileChooser chooser = new JFileChooser(); int result = chooser.showSaveDialog(mainpane); if (result == JFileChooser.APPROVE_OPTION) save(chooser.getSelectedFile()); } [46] Middle of the page, two new lines of code should be inserted: // Check mouse button release events, too. public void mouseReleased(MouseEvent e) { mousePressed(e); } The whole block, including the two new lines, should read: // Arrange to display the popup menu when the user clicks in the window panel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { // Check whether this is the right type of event to pop up a popup // menu on this platform. Usually checks for right button down. if (e.isPopupTrigger()) popup.show((Component)e.getSource(), e.getX(), e.getY()); } // Check mouse button release events, too. public void mouseReleased(MouseEvent e) { mousePressed(e); } }); [99] First and third equations; The affine transform matrix should have the following content in the 3x3 matrix: sx shx tx shy sy ty 0 0 1 The identity matrix should have the following content in the 3x3 matrix: 1 0 0 0 1 0 0 0 1 [100] The text reads: "When matrix elements are passed to or returned by an AffineTransform in an array of float or double values, they are stored in this order: [m00, m10, m01, m11, m01, m12] This corresponds to the following order using our mnemonic names: [sx, shy, sy, tx, ty]" It should be changed to: "When matrix elements are passed to or returned by an AffineTransform in an array of float or double values, they are stored in this order: [m00, m10, m01, m11, m02, m12] This corresponds to the following order using our mnemonic names: [sx, shy, shx, sy, tx, ty]" {106} Code example; The comment before g2.translate reads: //Use the top and left margins specificed in the PageFormat Note It should be changed to read: //Use the top and left margins specificed in the PageFormat. Note (134) Top of page; ...untrusted applet are... should be changed to: ...untrusted applets are... [150, 156] Figures 8-1 and 9-2; In the Key, the octagon shaped box that says "FINAL CLASS" should actually be a parallelogram that says "ABSTRACT CLASS". [402] Figure 23-3; The "AbstractAction" box should be a parallelogram, not a rectangle. {458} First paragraph; In listing valid values for the argument messageType, it lists INFO_MESSAGE. This should be changed to INFORMATION_MESSAGE. {531} Figure 26-1; The "MenuEvent" box should be changed to read "MouseEvent". {547} TreeModelEvent section; The first sentence reads: "An event of this type is generated when the contents of a java.awt.event.tree.TreeModel change." It should be changed to read: "An event of this type is generated when the contents of a javax.swing.tree.TreeModel change." [600] "Document" section; the last sentence of the first paragraph reads: When a JTree component displays a Document, the Element tree is used to create a tree of View objects that display the individual elements. It should be changed to read: When a JTextComponent displaysa Document, the Element tree is used to create a tree of View objects that display the individual elements. (639) "HTML.tag" section; In the second sentence "be-hav-iorbehavior" should be changed to "behavior". <689> 1st paragraph; The text reads: When you call redo(), it redoes the next significant edit and all insignificant errors that follow it. It should be changed to read: When you call redo(), it redoes the next significant edit and all insignificant errors that precede it.