Applet information for Ptolemy II Developers

Remote places to go
  • Sun:
  • Local Places to go:
  • Applet Coding Conventions
  • Troubleshooting Ptolemy II - Plug-in section
  • Contents:
  • Applet Features
  • Converting Applets to Applications

  • Applet Features

    An applet consists of an piece of html that downloads Java class files or jar files to the user's browser and then runs the Java code.

    Applets have a security model that prevents the Java code from performing unsafe actions. The Security Restrictions page of the Java tutorial describes these restrictions.

    Most of the Ptolemy II demonstrations were written as Java plug-in 1.4 applets. These applets use the Java Plug-in, which runs under both Netscape Communicator and Microsoft Internet Explorer. See the Plug-in section of the Ptolemy II Troubleshooting guide for details.

    Converting Applets to Applications

    Remote Links:
  • 1/97 Javaworld article about converting applets to applications
  • 7/98 Java Developer Connection (JDC) article about converting Applets into Applications (The JDC requires registration, but is free to join)
  • The old AWT Java Tutorial UI Components Problems page said:
    Problem: All your examples are of applets. How do I apply them to applications?

    Except where noted, anywhere in this trail that you see a subclass of the Applet class, you can substitute a subclass of the Panel class or, if the subclass isn't used as a container, a subclass of the Canvas class. In general, it's easy to convert an applet into an application, as long as the applet doesn't rely on any special applet abilities (such as using methods defined in the Applet class).

    To convert an applet into an application, you need to add a main() method that creates an instance of a Frame subclass, creates an instance of the Applet (or Panel or Canvas) subclass, adds the instance to the Frame, and then calls the init() and start() methods of the instance. The Frame subclass should have a handleEvent() implementation that handles WINDOW_DESTROY events in the appropriate way.

    See and for examples of an applet and an application that implement the same functionality.

    (The AWT Java Tutorial page is no longer on the web, it was replaced by the Swing Java Tutorial page)


  • You can customize your application so it has the proper interface
  • The application consists of one class, so shipping is easy
  • Disadvantages:
  • If your applet calls getParameter, then you will get a NullPointerException. The fix is to do something like
            try {
                dataurl = getParameter("dataurl");
            } catch (NullPointerException e) {
    	    dataurl = _dataurl;
  • Last Updated: $Date: 2014-09-24 07:50:41 -0700 (Wed, 24 Sep 2014) $