SWING overview

May 15, 2021 08:00 SWING

Table of contents

SWING - Overview

Swing API is a set of extensable GUI components that are used to create JAVA-based front-end/GUI applications. I t is built on the AWT API and serves as an alternative to the AWT API because almost every control corresponds to the AWT control. Swing components follow the model-view-controller architecture to meet the following guidelines.

  • A single API is sufficient to support multiple looks and styles.

  • APIs are impersonation-driven, so that the highest-level APIs do not require data.

  • The API uses the Java Bean pattern so that Builder Tools and IDEs can provide developers with better services to use it.

The MVC architecture

The Swing API architecture follows a loose MVC-based architecture in the following ways.

  • The model represents the data for the component.

  • Views represent a visual representation of component data.

  • The controller accepts the user's input on the view and reflects changes in the component's data.

  • The Swing component treats the model as a separate element and combines the view and controller sections into elements of the user interface. In this way, Swing has a pluggable look and feel architecture.

Swing features

  • Lightweight - Swing components are APIs for stand-alone local operating systems because Swing API controls are typically rendered using pure JAVA code rather than underlying operating system calls.

  • Rich controls -- Swing provides a rich set of advanced controls such as trees, tab forms, sliders, color selectors, and table controls

  • Advanced customization -- Swing controls can be customized in a very simple way because the visual appearance is represented independently of the internal.

  • Pluggable appearance and style - The look and feel of Swing-based GUI applications can change at runtime based on valid values.