Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing Vs AWT  RSS feed

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys! I was having an argument with my friend how Classes in AWT are actually more heavy weight than Swing. I even told him that some classes in the awt package are not entirely written in Java. But I need to give him proof. Do you guys agree? Could you point me to an article? Thanks!
 
Tim LeMaster
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about sun themself:

http://java.sun.com/products/jfc/reference/faqs/index.html#what_swing

http://java.sun.com/products/jfc/tsc/articles/mixing/
"And, since all AWT components are heavyweight and all Swing components are lightweight (except for the top-level ones: JWindow, JFrame, JDialog, and JApplet), these differences become painfully apparent when you start mixing Swing components with AWT components."
 
Edwin Dalorzo
Ranch Hand
Posts: 961
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I even told him that some classes in the awt package are not entirely written in Java.

What would they be written in then? AWT classes are all Java. But they call native interfaces.

Also note that as of 1.5.0_09 (I think) the statement that Swing components are lightweight (except for top level components) needs to be redefined. When using the native OS Look and Feel, Swing components like JButton, JLabel, JComboBox, etc now make similar native interface calls to the OS for drawing the widgets. I am sure Sun will still maintain these are lightweight, but arguably so.

I think what they have done is fixed the "mixing HW and LW components" issue to support native look and feel. But I don't know that for a fact.
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would they be written in then? AWT classes are all Java. But they call native interfaces.



I'm sure I've read that in a book somewhere... Deitel? Errr...

Thanks for the article guys! I'll just read those then.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Timothy Sam:
Deitel?


Well, that would be the problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!