Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
How do I convert a Java application to an applet?
Transforming a Java application to an applet can be either simple or difficult, depending on the requirements. At a minimum,
every applet requires that at least one HTML page refer to it with suitable parameters; a Java-enabled browser to display
that HTML page is needed as well. If you are using the applet only on your own machine, you can refer to this HTML page simply
with a URL of the form
file://C:\your\directory\your.html (on Windows) or
file:///your/directory/your.html (on Unix). The HTML page must at least contain the following:
<applet name=mainclass_name codebase=codebase_url height=height width=width></applet>. Your applet will be able to load all the classes it needs from the codebase, which may be specified with a URL as above
(but ending in a directory name or jar file name).
Let's look at this in more detail:
java.applet.Appletin which you override the
init()method to initialize your applet's resources the same way the
main()method initializes the app's resources. (
init()might be called more than once and should be designed accordingly. Moreover, the top-level
Panelneeds to be
add()ed to the applet in
init(); usually it was
add()ed to a
main().) That's it!
stop()methods so that the browser will take care of calling these methods when the applet comes in and out of focus.
http://server:portnum/path/page.html. In addition, there will have to be a Web server running at port, and the Web server will have to be accessible from the machine where the applet should be run.
Note that, by the time we reach our final example, the size of the application has become important. A small applet can download in this way quickly over a LAN -- almost as fast as from a local hard disk. But the larger the applet and the slower the network, the more noticeable the delay in loading. The fact that most applications are large and require the use of resources beyond those of the previous examples means that to convert the application to an applet requires significantly more effort. Essentially, it involves splitting the GUI-component from the rest of the application, creating the applet to distribute the GUI, and providing the other required services from the Web server. Servlets are a good server-side complementary Java technology.