1. Home
  2. Computing & Technology
  3. Java

Create a Simple Window Using JFrame

By Paul Leahy, About.com

7 of 7

Save, Compile and Run

Run the Application

Microsoft product screen shot(s) reprinted with permission from Microsoft Corporation.

Save the file as "TopLevelWindow.java".

Compile the application in a terminal window using the Javac compiler. If you’re unsure how to do so, look at the compilation steps from the first Java application tutorial.

javac TopLevelWindow.java

Once the application compiles successfully, run the program:

java TopLevelWindow

After pressing Enter, the window will appear, and you will see your first windowed application!

Well done, this tutorial is the first building block to making powerful user interfaces. Now that you know how to make the container, you can play with adding other graphical components.

Explore Java
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Java
  4. Tutorials
  5. Save, Compile and Run

©2009 About.com, a part of The New York Times Company.

All rights reserved.