SWING - Overview

Swing API is a set of extensible GUI Components to ease the developer's life to create JAVA based Front End/GUI Applications. It is build on top of AWT API and acts as a replacement of AWT API, since it has almost every control corresponding to AWT controls. Swing component follows a Model-View-Controller architecture to fulfill the following criterias.

  • A single API is to be sufficient to support multiple look and feel.

  • API is to be model driven so that the highest level API is not required to have data.

  • API is to use the Java Bean model so that Builder Tools and IDE can provide better services to the developers for use.

MVC Architecture

Swing API architecture follows loosely based MVC architecture in the following manner.

  • Model represents component's data.

  • View represents visual representation of the component's data.

  • Controller takes the input from the user on the view and reflects the changes in Component's data.

  • Swing component has Model as a seperate element, while the View and Controller part are clubbed in the User Interface elements. Because of which, Swing has a pluggable look-and-feel architecture.

Swing Features

  • Light Weight − Swing components are independent of native Operating System's API as Swing API controls are rendered mostly using pure JAVA code instead of underlying operating system calls.

  • Rich Controls − Swing provides a rich set of advanced controls like Tree, TabbedPane, slider, colorpicker, and table controls.

  • Highly Customizable − Swing controls can be customized in a very easy way as visual apperance is independent of internal representation.

  • Pluggable look-and-feel − SWING based GUI Application look and feel can be changed at run-time, based on available values.