• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing v/s AWT  RSS feed

 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What is meant by Swing being lightweight and AWT as heavy..


Regards
 
Stephen Foy
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Swing components are often described as lightweight because they do not require allocation of native resources in the operating system's windowing toolkit. The AWT components are referred to as heavyweight components." - Wikipedia
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heavyweight components create UI components in the native UI. So an AWT button is a Windows button. Lightweight components draw UI components. So a Swing button is a picture of a button. Now, where can Swing draw a component? On a heavy one. But Swing can draw a bunch of lightweight components on one heavyweight canvas so it has far fewer heavyweight components at runtime.

The original theory was that the AWT approach would be faster as drawing is done by API calls to the OS. But it led to OS dependencies and the "weight" problem. So Swing was added as an alternative.

UI experts check me ... is that right so far?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stan speaks the truth.

I'm going to move this to the Swing/AWT forum.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!