Swing is Graphical User Interface (GUI) widget for Java, it is an Application Programmer Interface (API) for developing GUI for Java programs. Swing provides more sophisticated set of GUI components than Abstract Window Toolkit (AWT). It has several components like buttons, checkboxes, textboxes, list, tabbed panel, scroll panel, tree, tables etc. Swing is not implemented by platform-specific code; it is written entirely in Java and is platform-independent.
Swing components are lightweight as they do not need allocation of native resources in the operating system’s windowing toolkit. Swing is a part of Java Foundation Classes. Java foundation classes (JFC) is an API for Java programs to create GUI.
GUI in Java Swing is created by first creating a container; basically, Frame is used to create container. Containers are those components on which other components can be added. The Java Swing components can be added to the container classes. Java Swing containers are:
Java Layout managers arrange the components inside a container. Several inbuilt layouts are defined in Java, but the most frequently used are: