Owl Sams Teach Yourself Java 2 in 21 Days Professional Reference Edition
/ YESTERDAY / TOMORROW

Day 10: Adding Images, Animation, and Sound

NOTES AND CORRECTIONS

  • None

SOURCE FILES

RESOURCE FILES

READER QUESTIONS

  • Q: Pg. 246 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. 249 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.