AWT Vs Swing
1 posts in topic
Flat View  Flat View

Posted By:   Krishna_Choudhury
Posted On:   Thursday, August 26, 2004 09:40 PM

Whats the difference between peer-based and non-peer based.

Re: AWT Vs Swing

Posted By:   pranav_sharma  
Posted On:   Sunday, October 17, 2004 09:56 PM

When developing a Java program it is important to select the appropriate Java Graphical User Interface (GUI) components. There are two basic sets of components that you will most likely build your Java programs with. These two groups of components are called the Abstract Window Toolkit (AWT) and Swing. Both of these groups of components are part of the Java Foundation Classes (JFC).

An Overview of the AWT
AWT stands for Abstract Window ToolKit. The Abstract Window Toolkit supports GUI Java programming. It is a portable GUI library for stand-alone applications and/or applets. The Abstract Window Toolkit provides the connection between your application and the native GUI. The AWT provides a high level of abstraction for your Java program since it hides you from the underlying details of the GUI your program will be running on.

AWT features include:

A rich set of user interface components.
A robust event-handling model.
Graphics and imaging tools, including shape, color, and font classes.
Layout managers, for flexible window layouts that don't depend on a particular window size or screen resolution.
Data transfer classes, for cut-and-paste through the native platform clipboard.
The AWT components depend on native code counterparts (called peers) to handle their functionality. Thus, these components are often called "heavyweight" components.

An Overview of Swing
Swing implements a set of GUI components that build on AWT technology and provide a pluggable look and feel. Swing is implemented entirely in the Java programming language, and is based on the JDK 1.1 Lightweight UI Framework.

Swing features include:

All the features of AWT.
100% Pure Java certified versions of the existing AWT component set (Button, Scrollbar, Label, etc.).
A rich set of higher-level components (such as tree view, list box, and tabbed panes).
Pure Java design, no reliance on peers.
Pluggable Look and Feel.
Swing components do not depend on peers to handle their functionality. Thus, these components are often called "lightweight" components.

AWT vs. Swing
There are, of course, both pros and cons to using either set of components from the JFC in your Java applications. Here is a summary:
About | Sitemap | Contact