|
Why will A good answer might be:Applets are not stand-alone objects, and only run in the context of a larger program (such as a browser.) |
Running an AppletTo run an applet, you need a web page that asks for it. A web page is a text file that can be displayed by a web browser. Here is a tiny web page that asks for the applet AnotherHello.class: <html> <body> <applet code="AnotherHello.class" width=300 height=150> </applet> </body> </html> To create a tiny web page, type the above characters into NotePad (or, more sensibly, copy and paste them into NotePad). Then save the file as AnotherHello.html in the same directory that has AnotherHello.class. The part of this "html" file that asks for an applet is this: This tells the browser to run the applet AnotherHello.class, and to use an area of the screen 300 pixels wide and 150 high. At this point your directory should look something like this:<applet code="AnotherHello.class" width=300 height=150> </applet>
Now you can use your web browser to look at AnotherHello.html.
Or you can use the appletviewer of the Java Development Kit:
The appletviewer will just show you the applet part of the ".html" file.C:\> appletviewer AnotherHello.html |
QUESTION 8:Fill in the blanks in the following ".html" file so that it asks to run the applet AEHousman in a window that is 250 pixels wide and 200 pixels high. Click Here after you have answered the question<html> <body> <applet code="_______________" width=_____ height=_____> </applet> </body> </html> |