What Is Swing?

This section describes what is Java Swing - a JDK class package that implements a set of components for building graphical user interfaces (GUIs) and adding rich graphics functionality and interactivity to Java applications.

What Is Swing? Swing is a Java package, javax.swing, provided in J2SDK (Java 2 Software Development Kit). It provides many enhancements to the existing graphics package, AWT (Abstract Windows Toolkit) package, java.awt.

javax.swing and java.awt together offer a complete API (Application Programming Interface) for Java applications to operate graphical devices and create GUI (Graphical User Interfaces).

The JDK 1.6 documentation offers another description of Swing: "The Swing classes (part of the Java Foundation Classes (JFC) software) implement a set of components for building graphical user interfaces (GUIs) and adding rich graphics functionality and interactivity to Java applications. The Swing components are implemented entirely in the Java programming language. The pluggable look and feel lets you create GUIs that can either look the same across platforms or can assume the look and feel of the current OS platform (such as Microsoft Windows, Solaris or Linux)."

The Swing package in JDK 1.8 contains following subpackages:

Last update: 2014.

Table of Contents

 About This Book

Introduction of Java Swing Package

What Is Swing?

 SwingHello.java - My First Swing Program

 Graphics Environment of the Local System

 JFrame - Main Frame Class

 JLabel - Swing Label Class

 JButton - Swing Button Class

 JRadioButton - Swing Radio Button Class

 JTextField - Swing Text Field Class

 Menu Bar, Menus, Menu Items and Listeners

 Creating Internal Frames inside the Main Frame

 Layout of Components in a Container

 LookAndFeel and UIManager

 Option Dialog Boxes

 JEditorPane - The Editor Pane Class

 SwingWorker - The Background Task Worker

 References

 PDF Printing Version