Java applets

Basically, an applet is a Java™ application (a rich client) running inside a Web browser. The main noticeable differences between applets and applications are:
  • Applets do not have the same kind of top-level container (like a JFrame , for example). Your Java code is not responsible for creating the main window, and your applets have to live within the limits of the provided ContentPane .
  • The code of the applet is usually invoked by a Web page downloaded from a remote website and executed on demand.
  • Unless your application is signed or your Java security policy has been extended, your applets have limited access to local resources, such as files, printers, and so on. This requires particular attention for dealing with security exceptions.
  • Most of the time applet classes and resources need to be packaged as JAR files and need to have a very clean access to their data, such as images or resource files.
Like other Java programs, a JViews application needs some particular attention to packaging and use as an applet. If possible, we recommend you use the IlvDiagrammerApplication class, which is already able to manage applets or applications. Most samples available in the JViews Diagrammer distribution are packaged so they can work transparently as applets or applications. If you decide to use lower-level containers, such as IlvDiagrammer , you will need to take more care in the integration with the top-level containers.

Creating an applet

The IlvDiagrammer instance and its associated beans can be used in applets in exactly the same way as in Swing applications. The only limitations are the restricted permissions in applets, for example, it is not possible to save data files from an applet.
The IlvDiagrammerApplication class extends the Swing JApplet class, so it can be used directly in an HTML applet tag. You can pass the command-line parameters as applet parameters: the names of the parameters are the same, without the "-" prefix.
For an example of an applet application, see the Applet sample, which is available in the directory <installdir>/jviews-diagrammer810/codefragments/applet.