Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing Components

 
kedar parundekar
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How AWT components are differ from swing components?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you search on "Swing versus AWT"
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Swing/AWT forum.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swing components have their own "look-and-feel," which is derived from Java. They make little use of the underlying OS, which is called "lightweight." Some AWT classes (eg Color) don't have a "look-and-feel" as such, and are therefore not duplicated in Swing. Their inheritance varies, but you will usually find a Swing class has a superclass in AWt somewhere. Those classes in Swing which correspond to AWT classes have the same name with a J prefix.

AWT components are older than the corresponding Swing classes, and they make heavy use of the OS, and are called "heavyweight." They do not have a "look-and-feel" of their own, but "borrow" a "look-and-feel" from the OS.

So: A Swing app using "metal" "look-and-feel" will run on Windows and on a Mac, and ought to look the same.
An AWT app will run on Windows and Mac, but will look different.

CR
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic