|
ROGERS CADENHEAD
My Projects
Workbench
SportsFilter
Drudge Retort
Watching the Watchers
RSS Spec
My Java Books
Teach Yourself Java 6 in 21 Days
Teach Yourself Programming with Java in 24 Hours, Fourth Edition
Teach Yourself Java 2 in 21 Days, Fourth Edition
Teach Yourself Java 2 in 21 Days Pro Reference Edition, Third Edition
Teach Yourself Java 2 in 24 Hours, Third Edition
My Weblogging Books
Movable Type 3 Bible Desktop Edition
Radio UserLand Kick Start
My Internet Books
Teach Yourself FrontPage 2003 in 24 Hours
|
Day 10: Adding Images, Animation, and Sound
NOTES AND CORRECTIONS
- On Page 244, two statements showing how to load an image in an
applet are incorrect. The code new URL should be replaced
with getImage, which turns the two statements into the
following:
- Image img = getImage(getDocumentBase(),
"book.gif");
- Image img = getImage(getDocumentBase(),
"images/book.gif");
- On Page 260, line 17 of Listing 10.5 has a semi-colon that
should be deleted. The correct line is the following:
SOURCE FILES
READER QUESTIONS
- Q: Pg. 244 states, "Choosing between getDocumentBase() or getCodebase() depends on whether your images are stored in subfolders of your Java applet or subfolders of the applet's Web page."
Since on pg. 247 we create a subfolder for the images I would have expected the
Fillmore.java and Neko.java to use getDocumentBase() instead of
getCodeBase(). Did I misunderstand? -- R.M.
A: The difference between getDocumentBase() and getCodeBase()
only matters when the applet's Java class is stored in a different folder
than the Web page that contains the applet. Because Fillmore.class
and Fillmore.html are both stored in \J21work, you can use
either method call and get the same result.
LINKS
|