Swing GUI Toolkit Group
This Group was dissolved and consolidated into the Client Libraries Group.
The Swing group is comprised of developers involved in the design, implementation, and maintanence of Swing GUI Toolkit.
Introduction
Swing is a Graphical User Interface (GUI) API, offering a set of components that can be used to build rich desktop interfaces. This includes basic elements such as windows, buttons, scrollbars, etc., as well as more complex compound objects such as file choosers, color choosers and combo boxes.
Architecture
Swing components are Java Beans, and are built around the Model-View-Controller (MVC) programming paradigm. This paradigm separates an application's business logic from its user interface so that they can be evolved independently.
JComponent
is the core Controller
class which coordinates Models and Views to display a final user
component. All Swing components are inherited from
JComponent
. Note that components can have different
views represented by different UIs.
The javax.swing.plaf
package contains
ComponentUI
, which is the core class for the
View and is a template for other components that
inherit from it. ComponentUI
is responsible for the
ultimate painting of pixels on the screen.
A Model controls the data in components, from
simple things such as the state of a check box, to the more complex
rows and columns data structures used for a table.
ComboBoxModel
and TableModel
are example
model classes.
Source Structure
All of the core Swing source code resides in the java.desktop
module, ie under java.desktop
. So subsequent paths
given below are relative to that base. For some exceptions to this
see the end of this section. Most of the source is under the
share/classes
directory. Under this directory, source
files are organized by their package hierarchy; for example, the
source for javax.swing.JButton
can be found in
share/classes/javax/swing/JButton.java
.
The javax.swing
package contains several
subpackages:
javax.swing.border
- specialized borders for Swing componentsjavax.swing.colorchooser
- classes and interfaces forJColorChooser
javax.swing.doc-files
- ancillary javadoc files for Swingjavax.swing.event
- Swing specific eventsjavax.swing.filechooser
- classes and interfaces forJFileChooser
javax.swing.plaf
- UI base classes and implementations for platform independent Look and Feelsjavax.swing.table
- classes and interfaces forJTable
javax.swing.text
- classes and interfaces for editable and non-editable text componentsjavax.swing.tree
- classes and interfaces forJTree
javax.swing.undo
- provides support for undo/redo operations
For historical reasons, some (traditionally) non-public
implementation classes are in a package starting with "sun". The
source for these classes can be found in
share/classes/sun/swing
.
Platform specific Look and Feels can be found in the
share/classes/com/sun/java/swing/plaf
directory. These
are non-public implementation classes.
The GTK Look and Feel contains native code implementing gtk rendering with the gtk 2 and gtk 3 system libraries:
unix/native/libawt_xawt/awt/swing_GTKEngine.c
unix/native/libawt_xawt/swing_GTKStyle.c
unix/native/libawt_xawt/gtk2_interface.h
unix/native/libawt_xawt/gtk2_interface.c
unix/native/libawt_xawt/gtk3_interface.h
unix/native/libawt_xawt/gtk3_interface.c
and also partly in:
unix/native/libawt_xawt/awt_UNIXToolkit.c
Exceptions
There are two other modules besides java.desktop for which the Swing group is responsiblejdk.accessibility
most of which is the Java Access Bridge support for screen readers such as JAWS. The javax.accessibility APIs are integrated into Swing which is why it falls under Swingjdk.unsupported.desktop
which provides some inter-op support between Swing and the OpenJFX toolkit.
Building The Source
Swing's make files can be found in :
make/modules/java.desktop
Community
- Mailing lists