p. 275: In the firstparagraph change "Example 9-5 is a complete applet that downloads a sound file called gong.au, which is located in the same directory as the applet" to "Example 9-5 is a complete applet that downloads a sound file called beep.au, which is located in the sounds directory just below the document base"
p. 296:
In the first two code fragments, change
MediaTracker.COMPLETED
to MediaTracker.COMPLETE
.
p. 298: In the second code fragment on this page ac.showDocument(oraHomePage)
should be ac.showDocument(oreillyHomePage)
p. 290: In order to make ImageSizer work with documents that use
a tag like <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
, you need to change
parser.parse(r, callback, false);
to
parser.parse(r, callback, true);
This tells the parser to ignore the character set header. To really make it work with other character sets, you need to detect the character set using the methods of Chapter 15 like so:
URL u = new URL(args[0]);
URLConnection uc = u.openConnection();
String type = uc.getContentType();
String charset = "ISO-8859-1";
// US-ASCII is more correct, but not all Java VMs support it
if (type != null) {
if (type.indexOf(';') >= 0) {
charset = type.substring(type.indexOf(';')).trim();
System.out.println(charset);
}
}
InputStream in = uc.getInputStream();
InputStreamReader r = new InputStreamReader(in, charset);
HTMLEditorKit.ParserCallback callback
= new ImageSizer2(new OutputStreamWriter(System.out), u);
parser.parse(r, callback, true);