Java Swing Tutorials - Herong's Tutorial Examples
∟Introduction of Java Swing Package
∟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 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 contains following subpackages:
- javax.swing - Provides a set of "lightweight" (written in Java with no native code) components that, to the maximum degree possible, work the same on all platforms.
- javax.swing.border - Provides classes and interfaces for drawing specialized borders around a Swing component.
- javax.swing.colorchooser - Contains classes and interfaces used by the JColorChooser component.
- javax.swing.event - Provides support for events fired by Swing components.
- javax.swing.filechooser - Contains classes and interfaces used by the JFileChooser component.
- javax.swing.plaf - Provides one interface and many abstract classes that Swing uses to provide its pluggable look and feel capabilities.
- javax.swing.plaf.basic - Provides user interface objects built according to the Basic look and feel.
- javax.swing.plaf.metal - Provides user interface objects built according to the Java look and feel (once codenamed Metal), which is the default look and feel.
- javax.swing.plaf.multi - Provides user interface objects that combine two or more look and feels.
- javax.swing.plaf.synth - Provides user interface objects for a skinnable look and feel in which all painting is delegated.
- javax.swing.table - Provides classes and interfaces for dealing with JTable.
- javax.swing.text - Provides classes and interfaces that deal with editable and non-editable text components.
- javax.swing.text.html - Provides the class HTMLEditorKit and supporting classes for creating HTML text editors.
- javax.swing.text.html.parser - Provides the default HTML parser, along with support classes.
- javax.swing.text.rtf - Provides a class (RTFEditorKit) for creating Rich Text Format text editors.
- javax.swing.tree - Provides classes and interfaces for dealing with JTree.
- javax.swing.undo - Allows developers to provide support for undo/redo in applications such as text editors.
Table of Contents
About This Book
JDK (Java Development Kit)
►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
JCheckBox - Swing Check Box Class
JRadioButton - Swing Radio Button Class
JTextField - Swing Text Field Class
JComboBox - Swing Combo Box 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
AWT (Abstract Windows Toolkit)
Integration with Desktop System
Archived Tutorials
References
Full Version in PDF/EPUB