Tuesday, June 27th, 2017

AWT & Swing

0

AWT:

Java programming language class library provides a user interface toolkit called the Abstract Windowing Toolkit (AWT). Effective graphical user interfaces are inherently challenging to design and implement, and the sometimes complicated interactions between classes in the AWT only make this task more complex. The AWT was designed so that programmers don’t have worry about the details of tracking the mouse or reading the keyboard, nor attend to the details of writing to the screen. The AWT provides a well-designed object-oriented interface to these low-level services and resources. AWT must also be platform-independent. The AWT was designed to provide a common set of tools for graphical user interface design that work on a variety of platforms. The user interface elements provided by the AWT are implemented using each platform’s native GUI toolkit, thereby preserving the look and feel of each platform.

Swing:

Java programming language class library provides a widget toolkit for Java . Swing is the part of JFC (Sun Microsystems’ Java Foundation Classes). Swing provides a native look and feel that emulates the look and feel of several platforms.

What are the architectural differences between Swing and AWT

There are no big architectural differences, the class hierarchy is almost the same. The reason is that
Swing is built upon AWT.

The most significant difference is how the components are drawn to the screen. AWT is so called
heavyweight components and have their own viewport which sends the output to the screen. Swing is
ligthweight components and does not write itself to the screen, but redirect it to the component it builds
on. Heavyweight components also have their own z-ordering. This is the reason why you can’t combine
AWT and Swing in the same container. If you do, AWT will always be drawn on top of the Swing
components.

You can combine AWT and Swing, just don’t do it in the same container (e.g. panel, groupbox, etc.) and
don’t put a heavyweight component inside a lightweight.

Another difference is that Swing is pure Java, and therefore platform independent. Swing looks
identically on all platforms, while AWT looks different on different platforms.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • RSS
  • Technorati
  • Twitter

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

Secure Linux Web Hosting