Java Swing

Let’s explore the Java swing tutorial. Before making our hands all dirty with the Swing, it is recommended that you go through the Abstract Window Toolkit (AWT). Earlier, Swing was added as a part of Java Foundation Classes (JFC). However, it was fully merged into Java from Java 1.2 onwards.

Swing Features

  1. Lightweight components – Since the Swing components are completely written in JAVA, they don’t use platform-specific resources as AWT components do.
  2. Pluggable Look and Feel (PLAF) – The Look and Feel of the component are entirely determined by Swing itself. That makes it easier to distinguish between look and feel and the logic of the component.

Swing GUI consists of two main pillars:-components and containers.The following part discusses about both of them thoroughly.


A component is simply an independent visual control. Swing components are derived from JComponent class. Further JComponent inherits all its characteristics from AWT containers and components. For more information, please go through the hierarchy of the JComponent class.

Some of the useful components are –

Text Components

Swing text components can be used to display or edit text. One example of this is JTextField, which can be used to enter a small amount of text from the user.


All containers are also components. Containers may comprise of one or more components. Swing defines two types of containers

  • Inherits from JComponent- e.g. JFrame, JWindow, JApplet, JDialog
  • Does not inherit from JComponent- e.g. JPanel


Swing comprises of numerous number of packages.Please go through the official documentation for more information.

More Information:

This article needs improvement. You can help improve this article. You can also write similar articles and help the community.