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:
|JApplet||It is an extension of Applet class, it is the swing's version of the applet.|
|JFrame||It is an extension of java.awt.Frame class, it is the swing's version of the frame.|
|JButton||It helps to realize a push button in the swing.|
|JTabbedPane||It helps to realize a tabbed pane in the swing.|
|JTree||It helps to realize a hierarchical tree or structure in the swing.|
|JComboBox||It helps to realize a combo box in the swing.|
A Swing GUI consists of two key items:
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
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 is a very large subsystem and makes use of many packages. These are the packages used by Swing are given below: