Java Applications

Applications are invoked from the command line and executed by the java interpreter. From the developer's point of view, there are primarily two differences between a Java applet and a Java application:

  • An application must include a main method.

  • If the application requires a window, it must extend the AWT Frame class.

A Frame is a window in which the application is displayed and, like all containers, comes with a layout manager for positioning and sizing its components. Additionally, a frame has insets that which must be taken into account when manually placing objects are manually placed—see “Differences Between Applets and Applications”.

There is one other notable distinction between a Java application and a Java applet. An ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.