• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference in AWT and SWING  RSS feed

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anybody explain the difference b/w AWT and Swing
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very simply, AWT uses the native platform's widget set using a lowest-common-denominator API. If you create a java.awt.Button, it's a Windows button if you run the program on Win32, and a Motif button if you run the program on Solaris, etc. It's hard to write AWT GUIs which look good everywhere.
Swing's widgets are drawn on the screen using Java graphics calls. They look exactly alike on every platform. They have a much richer API, since they can do thiings the native platform's GUI widgets might not normally do.
The Eclipse project's SWT is a kind of hybrid of these. It uses native widgets on platforms where they're available, and emulation for missing features.
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AWT Look&Feel depends on the underlying operating system being used. But in Swing, as no peer components are brought from Operating System for displaying the component, you can have different LAFs in same screen.
AWT is Least Common Denomenator of all the components that are available on all Operating Systems. JFC (Swing) has a wide set of components that can be used across all platforms.
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AWT is Least Common Denomenator of all the components that are available on all Operating Systems. JFC (Swing) has a wide set of components that can be used across all platforms.

I don't mean to be picky but aren't both AWT & Swing part of the JFC. Since the discussion is on the difference between AWT & Swing it seems relevant. Ernest's answer was fantastic I don't think I've seen it put so well before.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!