Java Swing is used to create window-based applications.
Swing is a part of Java Foundation Classes (JFC). It is entirely written in java.
Unlike AWT, Java Swing provides
platform-independent and lightweight components.
AWT provides less
components than Swing. AWT doesn't
follows MVC (Model View Controller) where model represents data, view
represents presentation and controller acts as an interface between model and
view. Swing is follows MVC.
The javax.swing package provides classes
for java swing API such as JButton, JTextField, JTextArea, JRadioButton,
JCheckbox, JMenu, JColorChooser etc.
Java Foundation Classes
(JFC) are a set of GUI components which simplify the development of desktop
The hierarchy of java swing
API is given below:
There are two ways to create a Frame:
creating the object of Frame class
extending Frame class
Program for creating the object of Frame class is: