Once your applet has been compiled, it must run in a graphic window that is large enough to accommodate the pixels in the applet. The following HTML code will meet all the requirements to run the Hello.class that was written if you completed the section on writing a Java applet. Any applet will serve for this example as long as three requirements are met. If you haven't written any applets yet, you may follow the link to this lesson when you do.
The defined applet window must be large enough to hold the applet or it will be cropped.
The name of the file called within the HTML code must match the name of the class file exactly, including the case of the letters.
The compiled class file must be in the same directory as the HTML code that is calling it (or the precise path must be specified in the HTML code.)
View of the applet's output
<html> <p
align="left"><font size="6"> |
|
When you load the HTML file in your browser the applet will execute within the window.
This generic HTML page can be used to display all of your applets (providing they fit in a 301x301 pixel window). If not you must determine how many pixels are needed for your window.
Hit the "Return to previous page" or "back" button on your browser
Go to the next topic: The Graphics Coordinate System