The JavaTM Tutorial
Previous Page Trail Contents Next Page Start of Tutorial Search
Feedback Form
Examples Index

Trail: Creating a GUI with JFC/Swing

Also known as The Swing Tutorial

This trail tells you how to create graphical user interfaces (GUIs) for applications and applets, using the Swing components. The Swing components, which are part of the JavaTM Foundation Classes (JFC), can be used with either JDKTM 1.1 or the JavaTM 2 platform.

Note:  This trail does not tell you how to use the AWT components. Information on them is in the old UI trail, which is available for downloading as Creating a User Interface (AWT Only)(outside of the tutorial).

Book cover: The JFC Swing Tutorial This trail is available as a book, The JFC Swing Tutorial(outside of the tutorial). A shorter, simpler introduction to using the Swing components was published as a chapter in the book The Java Tutorial, 3rd Edition(outside of the tutorial) and is available online (in the Creating a GUI with JFC/Swing trail).


Getting Started with Swing is a quick start lesson. First it gives you a bit of background about the JFC and Swing. Then it tells you how to compile and run programs -- both applications and applets -- that use Swing components. Finally, it walks you through the code for a simple program.

Swing Features and Concepts gives you the information you need to be able to use Swing components effectively. For example, it tells you how Swing programs display their GUIs, how they handle events such as mouse clicks, and how they can use features such as borders to help with layout. It ends with a discussion of how the features and concepts are used by a real program.

Using Swing Components tells you how to use each of the Swing components -- buttons, tables, text components, and all the rest.

Using Other Swing Features tells you how to use actions, borders, icons, and timers. It also helps you to create multithreaded programs.

Laying Out Components Within a Container tells you how to choose a layout manager, how to use each of the layout manager classes the JavaTM platform provides, how to use absolute positioning instead of a layout manager, and how to create your own layout manager.

Writing Event Listeners tells you how to handle events in your programs.

Working with Graphics tells you how to do everything from drawing lines and text to loading, displaying, and manipulating images. It includes information on performing animation and on improving graphics performance.

Converting to Swing tells you how to convert programs that use the 1.1 AWT API to use the Swing components.

Although this is the main trail for learning about GUIs, it isn't the only trail with UI-related information. Here are some other trails that discuss UI topics:


Your feedback is important to us! Please send your comments and suggestions to us using the feedback page.

Previous Page Trail Contents Next Page Start of Tutorial Search
Feedback Form
Examples Index

Copyright 1995-2001 Sun Microsystems, Inc. All rights reserved.