Java AWT Reference by John Zukowski This errata page lists errors outstanding in the most recent printing, 8/97. 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 last modified on September 28, 1998. 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: (37) The first line of text has only one word; the rest of the paragraph should be brought up. {77, 668} FontMetrics::getWidths() returns an array of 256 ints, not 255 (0 to 255) (84) under heading public static Color getColor(String name, Color defaultColor), second paragraph there is a big hole in the second line. {97} There needs to be a footnote after the clause "Using the screen in Figure 4-1 as the basis," in section 4.1.3: The call path shown is generated by following the methods called from the Java source code (.java files). It is possible that a platform reduces the overhead by performing some operations in the Java peers. {180} In the Keyboard section, the method signatures public boolean keyDown(Event e, int key) public boolean keyUp(Event e, int key) should both have a hollow star (Java 1.0 depricated method) next to them. keyDown currently has a solid star and keyUp does not have either. {207} Container::component add(Component, int) end of 1st paragraph : if you try to add _component_ to to a container that already contains it, the COMPONENT is removed and re-added, probably at a different position. {212} In discussion of the invalidate() method: "recursively invalidates the children" should be "recursively invalidates the parent containers" {229} Change text of section titled: Listeners and 1.1 event handling [This includes top of the next page] With the 1.1 event model, you register listeners for different event types; the listeners are told when the event happens. The Frame class inherits all its listener handling from Window. With Java 1.1, it isn't necessary to subclass Frame to handle the WINDOW_CLOSING events. The equivalent Java 1.1 code to handle the event follows: Frame f = new Frame(); f.addWindowListener (new WindowAdapter() { public void windowClosing (WindowEvent e) { setVisible(false); dispose(); System.exit(0); } }); This adds an anonymous inner class of type WindowAdapter as the WindowListener. When the window closing event happens, it causes the program to exit. Every Frame created should include code like this to make sure they terminate gracefully. {274} in the description of "public int[][] getLayoutDimenstions ()", sentence 2: "Index 0 is an array of widths" should be "Index 0 is a copy of an array of widths" and "index 1 is an array of heights" should be "index 1 is a copy of an array of heights" {353} "public int getSelectedCheckbox()" should be "public Checkbox getSelectedCheckbox()". {364} the list item: public void addActionListener(ItemListener listener) should be public synchronized void addActionListener(ActionListener listener) and the list item: public void removeActionListener(ItemListener listener) should be public synchronized void removeActionListener(ActionListener listener) {370} OK, here's the background. Solaris machine running Java 1.1, but using 1.0 event model. CheckboxMenuItem is supposed to return an arg, which is the string of the label of the CheckboxMenuItem. Instead, the arg of action() produces a boolean, which is the state of the CheckboxMenuItem. from the author: The behavior that you noticed seems to be a compatibility difference that Sun doesn't document and I missed too. Under 1.0, the CheckboxMenuItem action has the label as its argument. While running a 1.0 event model program under 1.1, this is the state. {625} Container.invalidate(): method is missing filled star, and description should be changed to: Notifies container's layout manager of invalid state and invalidates parent containers. {653} The description for postEvent is missing. {959} The handleEvent method should have a parameter of type "AWTEvent", not "Event". This should also be corrected in the parameter description where "Event" appears in Courier. There needs to be a star or a footnote for this change. In Java 1.0, the parameter is of type Event. However, in 1.1, the parameter is of type AWTEvent. {999-1002} There are several references to an "ARCHIVES=" parameter to the tag in HTML. According to Sun's documentation, and confirmed by my own testing, the correct name of this parameter is "ARCHIVE" (no plural).