- Forward


A Comparison of Applets and Applications
in Java


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Review
Back SMYC Forward
  • Program (in an Object-Oriented Language):
    • A group of cooperating classes with a well-defined entry point (i.e., a method that should be executed first)and, perhaps, a re-entry point and/or an exit point.
  • Application:
    • Runs under the operating system
    • Entry point is main()
    • Top-level container is usually a JFrame (or Frame)
  • Applet:
    • Runs inside of a client (e.g., a browser)
    • Entry point is init() and then start()
    • Top-level container is a JApplet (or Applet)
Some Observations
Back SMYC Forward
  • Applets and applications have different programming interfaces
  • Applets and applications have different lifecycles
  • Applets and applications obtain start-up parameters in different ways
Some Things to Be Careful About
Back SMYC Forward
  • A Technical Issue:
    • Make sure methods that manipulate the GUI are called in the event dispatch thread
  • A Design-Related Issue:
    • If you write an applet and an application with the same functionality they will have an enormous amount of duplicate code
  • An Environment Issue:
    • The RootPaneContainer for a JApplet has access to the start-up parameters whereas the RootPaneContainer for an application (which is a JFrame) does not.
There's Always More to Learn
Back -