• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is the difference between AWTs and Swings

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

Can anybody please tell me what is the difference between AWT and Swings..

Thanks,
Gayathri Chowduru.
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AWT - has platform dependencies. i.e the API is tied with the OS libraries.

Swing - has no platform dependencies. It is considered as light weight as all its widgets are written in pure Java except JFrame which is tied with native C code.
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Swing - has no platform dependencies. It is considered as light weight as all its widgets are written in pure Java except JFrame which is tied with native C code



You are correct but all top level containers namely JFrame, JWindow, JDialog, JApplet etc are OS dependant not only JFrame.

Swing supports Double Buffering and AWT does not support Double Buffering.

Swing has rich set of UI Interface components namely JTable, JTreeView etc
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To say that one has OS or platform dependencies and the other doesn't is a bit misleading. Both depend on a JVM with class libraries to run on; whether the drawing uses OS-native widgets on top of that is generally of lesser concern.

Swing is skinnable (what it refers to as its "Look & Feel"). There are cross-platform skins (Metal) as well as skins that are supposed to look like the native platform (Windows, OS X, Motif, GTK).
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://dn.codegear.com/article/26970

mixing the Swing and AWT components will not produce a compile-time error, but the result may not display correctly. The Graphics, Color, Font, layout, listener, ... classes are from AWT, so you typically need to have imports from AWT.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Gayathri Chowduru:
Hi Everyone,

Can anybody please tell me what is the difference between AWT and Swings..

Thanks,
Gayathri Chowduru.

 
varahalaraju penmetsa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry , unfortunately i have clicked add replay

ya the differences between swings and awt

AWT components are heavy weight components that means they will use some native methods to display or render the components.

because of this native stuff , the look and feel of the awt components are decided by underlaying platform not java. so each component may look or even act differently in different platforms and this inconsistent look and feel spoils the suns philosophy "write once use any ware " thats y they have introduced swings

AWT components places some restrictions like thay can be only opaque and rectangle only we can not change,

so java introduced swings with two advantages
1. light weight components
2. pluggable look and feel
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

because of this native stuff , the look and feel of the awt components are decided by underlaying platform not java. so each component may look or even act differently in different platforms and this inconsistent look and feel spoils the suns philosophy "write once use any ware " thats y they have introduced swings



It should be noted that the look-and-feel implementations of Swing are quite close to the underlying OS's native look where those exist (OS X, Windows XP, Motif, GTK). It's been recognized that a look consistent with the native platform is more important than a look that is consistent across platforms (most people don't use the same application on more than a single platform anyway).

Also, the name of the toolkit is "Swing", not "swings".
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic