Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Q&A

  1. Is there a reason why the CODEBASE attribute should be used in an <APPLET> or <OBJECT> tag?

    If all Java programs are grouped into their own subfolder, as indicated by CODEBASE, this structure might improve the way a Web site is organized, but there's no other reason why using CODEBASE is better than omitting it. The choice is a matter of personal preference.

  2. What happens if the height and width specified for an applet don't leave enough room for the information that is displayed in the paint() method?

    The information will be drawn offscreen, beyond the edges of the applet window, and won't be visible at any point while the applet runs. Choosing the right dimensions for an applet is largely a matter of trial-and-error until you find the right size for both the HEIGHT and WIDTH attributes of the <APPLET> tag. You can't resize an applet window from within a Java program, so the only way to control its size is by using the HEIGHT and WIDTH attributes. Fortunately, you can change the Web page's HTML without having to recompile the Java program.

Share ThisShare This

Informit Network