Java Reference
In-Depth Information
place the following archive argument in the applet tag:
archive = "Apple.jar"
Now, only one file has to be retrieved instead of many.
We have neglected to talk about passing parameters to the applet through the
applet tag. See any html manual for a complete discussion of applet tags.
Concluding remarks
There are many more html tags, for example for linking to images and set-
ting tables of data, but they should not be hard to learn.
A word of caution in using html the way we have shown. The trend is to
eschew tags like
<font>
,
<b>
,
<i>
, and
<u>
and to use
styles
instead —this is not
the place to explain styles. For now, there is nothing wrong with trying to write
a few web pages using the commands we have described simply to get a feel for
how html works.
Several software applications can help you write html pages without actual-
ly requiring you to look at the source html.
Netscape Communicator
is perhaps
the simplest and is useful when one or two web pages have to be written. When
a large web site is to be designed and implemented, one often use Macromedia's
DreamWeaver
or Microsoft's
FrontPage
.
Security with applets
Security is an important topic, given the current rash of attempts to break
into and destroy people's web sites and computers. Lesson page 16-2 of
ProgramLive
contains a footnote that explains why applets are safe.
16.5
Key concepts
• Java application
. An application is a set of Java classes in which some class
has a static procedure
main
, with a single parameter of type
String[]
.
• Jar file
. A java application can be packaged in a jar file as a stand-alone appli-
cation. It can then be executed with the jar command or by double clicking on it.
• Java applet
. An applet is a Java class that is a subclass of class
Applet
. The
subclass can override inherited procedures
paint
,
init
,
start
,
stop
, and
destroy
in order to have the applet do something. Use class
JApplet
(which is
a subclass of
Applet
) in the Swing package, instead of
Applet
.
• Html and the applet tag
. Html (HyperText Markup Language) is the language
in which web pages are written. An applet can be included on a page using the
applet tag. For efficiency, the classes that make up an applet can be placed in a
jar file.
Search WWH ::
Custom Search