Features of Swing in Java

Swing is a GUI toolkit that facilitates the creation of highly interactive GUI applications. Swing is more flexible and robust when it comes to implementing graphical components. Swing can be regarded as more graphically-rich than AWT not only because they provide some entirely new graphical components like a tabbed window and tree structure. Some of the key swing classes are given as below :

Swing Class Description
JAppletIt is an extension of Applet class, it is the swing's version of the applet.
JFrameIt is an extension of java.awt.Frame class, it is the swing's version of the frame.
JButtonIt helps to realize a push button in the swing.
JTabbedPaneIt helps to realize a tabbed pane in the swing.
JTreeIt helps to realize a hierarchical tree or structure in the swing.
JComboBoxIt helps to realize a combo box in the swing.

A Swing GUI consists of two key items:
1. Components
2. Containers


In Swing, Components are derived from the JComponent class where JComponent provides the functionality that is common to all components.
Example: JComponent supports the pluggable look and feel.


JComponent inherits the AWT classes Container and Component. Thus, a Swing component is built on and compatible with an AWT component. All of Swing’s components are represented by classes defined within the package javax.swing.
A Container holds a group of components. Thus, a container is a special type of component that is designed to hold other components. Thus, all Swing GUIs will have at least one container. Because containers are components, a container can also hold other containers.

Swing Packages:

Swing is a very large subsystem and makes use of many packages. These are the packages used by Swing that are given below:

javax.swing javax.swing.borderjavax.swing.colorchooser
javax.swing.eventjavax.swing.filechooser javax.swing.plaf

Recommended Posts:

Advanced Java
    1. Java Applet
    2. Applet Life Cycle in Java
    3. Difference Between Applet and Application
    4. Creating an Executable Applet in Java
    5. Displaying Numerical values in Applet
    6. An Applet Program to Add Two Numbers
    7. Event Handling in Applet
    8. AWT Event Classes
    9. AWT Graphics Class
    10. Draw a line and rectangle in Java Applet
    11. Draw Circles and Ellipses in Java Applet
    12. Draw a Polygon in Java Applet
    13. AWT Hierarchy | AWT Package
    14. Swing in Core Java