• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Diferences between AWT and Swing

Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anyone tell me what are the main diferences between AWT and Swing.
Why should I use Swing and not the AWT?
Is Swing and improved "version" of AWT?
Sorry 'bout the basic questions...
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question has come up a couple of times. AWT was Sun's first cut
at a GUI package for Java. The AWT team then identified several issues
they wanted to address and a splinter group began work on Swing,
which was originally a separately downloadable package. I believe that
in release 1.2 Swing was officially added to the J2SE core. The Swing Connection article, Getting Started With Swing, explains some of the major improvemnts. Here is
a summary:
- pluggable look and feel
This is especially exciting with the introduction, in release 1.4.2,
of the GTK look and feel.
- accessibility support
This is especially important now that providing accessible applications
is a Federal law, at least here in the U.S.
- much more sophisticated component design
For example, Swing components double buffer, AWT components don't.
AWT doesn't have complex components like JTable.
Swing components have built-in drag and drop support.
This list could go on and on...
You might also find the article by one of AWT and Swing's principle
designers, Amy Fowler, interesting,
Mixing Heavy and Light Components. (By the way, we don't recommend mixing heavyweight
and lightweight components, but it's an interesting article, none the less.)
One complaint that has been leveled against Swing is that it's slow.
This has been a concern within Sun and a major push, as of release 1.4,
was to improve performance. Release 1.4 did have major performance
improvements and this continues to be an ongoing effort.
I hope that answers some of your questions. Kathy has worked at Sun
for over 10 years and may have more interesting perspectives than I, who
has worked at Sun for only 5 years.
Sharon Zakhour
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sharon answered well. The only thing I'd add is that I believe AWT components are fully accessible now. Still, Sun strongly recommends using Swing instead of AWT whenever possible. My guess is that accessibility was the last feature added to the AWT components. Swing components, on the other hand, are actively being improved and extended.
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Good Painting Code Is the Key to App Performance
By Amy Fowler
In a graphical system, a windowing toolkit is usually responsible for providing a framework to make it relatively painless for a graphical user interface (GUI) to render the right bits to the screen at the right time.
Both the AWT (abstract windowing toolkit) and Swing provide such a framework. But the APIs that implement it are not well understood by some developers -- a problem that has led to programs not performing as well as they could.
This article explains the AWT and Swing paint mechanisms in detail. Its purpose is to help developers write correct and efficient GUI painting code. While the article covers the general paint mechanism (where and when to render), it does not tell how to use Swing's graphics APIs to render a correct output. To learn how to render nice graphics, visit the Java 2D Web site.
The main topics covered in this article are:
Evolution of Paint System
Painting in the AWT
System-Triggered vs. App-Triggered Painting
The Paint Method
Painting & Lightweight Components
"Smart" Painting
AWT Painting Guidelines
Painting in Swing
Double Buffering Support
Additional Paint Properties
The Paint Methods
Paint Processing
The Repaint Manager
Swing Painting Guidelines

Reference website
Evildoers! Eat my justice! And this tiny ad's justice too!
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic