Introduction to Swing classes

Introduction to Swing classes

Posted in : Core Java Posted on : October 23, 2010 at 6:23 PM Comments : [ 0 ]

This section contains the Introduction to Swing classes in java.

Introduction to Swing classes

Swing library is an official Java GUI toolkit released by Sun Microsystems in1997 with JDK 1.2. Swing is a part of JFC, Java Foundation Classes. It is a collection of packages for creating full featured desktop applications. JFC consists of AWT, Swing, Accessibility, Java 2D, and Drag and Drop. The Java platform has Java2D library, which enables developers to create advanced 2D graphics and imaging.

Swing has :

  • 100% Java implementation of components
  • Pluggable Look & Feel
  • Lightweight components
  • Uses MVC Architecture
    Model represents the data
    View as a visual representation of the data
    Controller takes input and translates it to changes in data
  • Three parts
    Component set (subclasses of JComponent)
    Support classes

The main characteristics of the Swing toolkit

  • platform independent
  • customizable
  • extensible
  • configurable
  • lightweight

The design of the Swing component classes is loosely based on the Model-View-Controller architecture, or MVC.

  1. The model stores the data.
  2. The view creates the visual representation from the data in the model.
  3. The controller deals with user interaction and modifies the model and/or the view.

Class hierarchy of Swing

Swing contains components that you?ll use to build a GUI. The class JComponent, descended directly from Container, is the root class for most of Swing?s user interface components.

Swing Component class description

Some of the main Swing component classes are given below :

   Class      Description 
 AbstractButton   Abstract superclass for Awing buttons.
ButtonGroup Encapsulates a mutually exclusive set of buttons.
ImageIcon Encapsulates an icon.
JApplet The Swing version of Applet.
JButton The Swing push Button class.
JCheckBox The Swing check box class.
JComboBox Encapsulates a combo box.
JLabel The Swing version of a label.
JRadioButton The Swing version of a radio button.
JScrollPane Encapsulate a scrollable window.
JTabbedPane Encapsulate a tabbed window.
JTextField The Swing version of a text field.
JTree Encapsulate a tree-based control.


Go to Topic «PreviousHomeNext»

Your Comment:

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image

Tutorial Topics