The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search

Trail: Creating a GUI with JFC/Swing
Lesson: Getting Started with Swing

Compiling and Running Swing Programs

This section tells you how to compile and run a Swing application. The compilation instructions work for all Swing programs -- applets, as well as applications. If you're interested in Swing applets, you should also read Running Swing Applets. If you aren't yet interested in compiling and running Swing programs, you can skip directly to A Quick Tour of a Swing Application's Code, which guides you through the code for a simple application.

The instructions in this section assume that you're already comfortable with writing and compiling programs that use the Java platform. If you aren't, please go to the Getting Started(in the Getting Started trail) trail. In particular, you'll need to successfully follow the instructions in The "Hello World" Application(in the Getting Started trail) before you attempt to compile and run any Swing programs.

How you compile and run Swing programs depends on whether you're using JDK 1.1 or JDK 1.2. Using JDK 1.2 is a bit simpler because Swing is built in to JDK 1.2. Choose the instructions corresponding to the release you're using:

Both instructions tell you how to run a simple program, called SwingApplication, whose GUI looks like this:

SwingApplication

.

Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search