A Graphical User Interface is an interface for users to provide instructions for the software to perform tasks. It consists of various graphical components. Some GUI components are window, button, combo box, text area, list box, and label. Using these components, the programmer can develop an interactive user interface for the application. A GUI is based on events. Button click, closing the window, typing something in the textbox are some examples of events that can occur in a Graphical User Interface based application. Today many applications contain GUIs. Mobile applications, Air ticket reservation systems, Automated Teller Machines have rich graphical interfaces for customers to use the application easily.
Swing is a GUI widget toolkit for Java. It is a part of Oracle’s Java Foundation Classes (JFC). It is an Application Programming Interface to build GUI for Java applications. It is built on top of AWT API. Swing was developed to provide more flexible and sophisticated components than AWT. Swing contains basic components such as labels, text boxes, buttons. It also contains more advanced components. Some of them are trees, tables, lists, scroll panes and tabbed panes. If the programmer needs to implement a Swing application, it is necessary to import javax.swing package. The package provides classes for Java Swing API such as JButton, JRadioButton, JTextField, JCheckbox etc.