HelloApplet as a Standalone Application

Recall that the first applet example (HelloApplet) ran in a Graphical User Interface (GUI) provided by the Web browser. You don't need to limit your Java GUI programming to writing applets that run only inside Web pages—you can write a standalone application with its own graphical environment.

It is often more appropriate—or more convenient—to write a standalone Java application. A servlet—a Java program that runs on your Web server—is one example of a Java application; it runs in the environment of a Web server such as Sun's Java Server. The HelloGUI program described here is another example.

Writing the Standalone Application

It is not much work at all to convert an applet into a standalone Java application. ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 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.