Please Note: These Errata are from the 1st edition of Up to Speed with Swing. Corrections have been incorporated into the 2nd edition of the book.
From the author:
Well, even though everyone tried very hard to produce a perfect book, there have been a few problems. Some of them are minor annoyances like formatting problems, others are changes to the API, and some are just dumb bugs. Regardless of their origins, this errata section identifies those problems that are known and, if possible, ways to work around them.
All of the errors listed here occur in the first printing of the book and have been corrected in subsequent printings.
Page 15
private TextFieldtextField = null;
Should read:
private TextField textField = null;>
Page 38, last paragraph
...how to the correct data...
Should read:
...how to display the correct data...
Page 39, second sentence
addition attributes
Should read:
Page 44
FontMetricsfm = g.getFontMetrics();
Should read:
FontMetrics fm = g.getFontMetrics();
This occurs in two places on the page.
Page 70
JPanelpanel = new JPanel();
Should read:
JPanel panel = new JPanel();
Page 98, last paragraph
...in listing 3.6
Should read:
...in listing 3.7
Page 104
Shortly after this book went to print, Sun made a change to the Swing class library and releases version 1.0.2. In this new release, the JDirectoryPane class has been eliminated. If you are using Swing 1.0.2 or later, the information and examples in section 3.12 of the book will no longer be appropriate.
Page 112
The code in listing 4.1 sets label3 to "Enabled." The figure 4.1 output shows "Label3" as the text.
Page 117
public void setHorizontalTextPosition(int x)
Should read:
public void setHorizontalTextPosition(int textPosition)
Page 150
private JTextFieldfield1;
private JTextFieldfield2;
Should read:
private JTextField field1;
private JTextField field2;
Page 151
public voidactionPerformed( ActionEvent e )
Should read:
public void actionPerformed( ActionEvent e )
public voidinserUpdate( DocumentEvent e )
Should read:
public void inserUpdate( DocumentEvent e )
StringsString = field1.getText();
Should read:
String sString = field1.getText();
Page 162
public void insertItemAt(Object anObject,
Should read:
public void insertItemAt(Object anObject, anIndex)
Page 172, second paragraph, second sentence
...apply to any test we...
Should read:
...apply to any text we...
Page 185
private Jpanel topPanel;
Should read:
private JPanel topPanel;
Page 267
Shortly after this book went to print, Sun made a change to the Swing class library and releases version 1.0.2. In this new release, the JFileChooser class was changed dramatically. As a result, the code shown in section 8.4 of the book no longer works. New code will be added to the web site as soon as the API for this class stabilizes.
Page 289
// Add this item to the list and refresh
Should read:
// Remove this item from the list and refresh
Pages 310, 313, 317, 323, 325, 326
// Add the list box to a scrolling pane
Should read:
// Add the tree to a scrolling pane
Pages 312, 322, 339, 341, 345, 359, 362, 367
private JScrollPanescrollPane;
Should read:
private JScrollPane scrollPane;
Page 313, last sentence
...all consist of a null string...
Should read:
...all consist of an empty string...
Page 314
private StringcardArray[] = {
Should read:
private String cardArray[] = {
Page 314
private DefaultMutableTreeNoderoot;
Should read:
private DefaultMutableTreeNode root;
Page 318
implementsTreeCellRenderer
Should read:
Implements TreeCellRenderer
Page 334, last sentence (again on page 335)
...customer data model[s]...
Should read:
...custom data model[s]...
Page 335
new TreeCellRender
Should read:
new TreeCellEditor
Page 349
for( int iCtr = 0; iCtr < 8; iCtr++ )
Should read:
for( int iCtr = 0; iCtr < 4; iCtr++ )
Page 351, 376
StringsText = (String)value;
Should read:
String sText = (String)value;
Page 359, first line
JTable...
Should read:
JList...
Page 366, second paragraph, first sentence
...we can developer...
Should read:
...we can develop...
Page 367
setTitle( "Advance JTable Application" );
Should read:
setTitle( "Advanced JTable Application" );
Page 369
private CustomDataModelmodel;
Should read:
private CustomDataModel model;
Page 371-372
private StringtypeString;
private StringnameString;
private StringlocationString;
private StringstatusString;
Should read:
private String typeString;
private String nameString;
private String locationString;
private String statusString;
Page 377
public VectorvectorService;
public VectorvectorDisplayService;
Should read:
public Vector vectorService;
public Vector vectorDisplayService;
Page 414
private AbstractButtonab;
Should read:
private AbstractButton ab;