Page 1 of 1

Which is better Java AWT or Java Swing?

Posted: Mon Dec 05, 2005 3:29 pm
by raghavan20
I have started studying JAVA and I wanted to know which of these, Java AWT or Java SWING package is the best?
How many of you think Swing is better and can you tell why you feel like that?
But it's been said that AWT is supported many other devices as well and AWT is superior...how many agree to it?

Posted: Mon Dec 05, 2005 3:33 pm
by foobar
Swing. No two ways about it. That's because Swing is based on AWT is actually an up-dated/graded version of it, in many ways. As it is, it provides more control over your UI, with more flexibility. Check the java.sun.com docs on Swing for reference.

Some comparisons of AWT and Swing:

http://bdn.borland.com/article/0,1410,26970,00.html
http://forum.java.sun.com/thread.jspa?t ... 0&tstart=0

Here's my Google search:

http://www.google.com/search?hl=en&q=AW ... d+to+Swing

Posted: Mon Dec 05, 2005 5:52 pm
by pickle
I'd say Swing based solely on my experience in school programming with them. Swing was MUCH easier to deal with.

Posted: Tue Dec 06, 2005 2:53 am
by n00b Saibot
foobar wrote:That's because Swing is based on AWT is actually an up-dated/graded version of it, in many ways.
As far as I remember, Swing API was written purely from scratch, not taking any of the existing AWT codebase. The reason was to eliminate the peer latching mechanism that was employed in AWT framework. So, A Button would look different on Mac, Win and UNIX Platforms. Swing has it own Pluggable Look & Feel (PLAF) packages which can gives you uniform look & feel over different OSes. Many other APIs were also coded at that time but none was so swift at it... so none other gained popularity.

Posted: Tue Dec 06, 2005 3:24 am
by foobar
n00b Saibot wrote:
foobar wrote:That's because Swing is based on AWT is actually an up-dated/graded version of it, in many ways.
As far as I remember, Swing API was written purely from scratch, not taking any of the existing AWT codebase. The reason was to eliminate the peer latching mechanism that was employed in AWT framework. So, A Button would look different on Mac, Win and UNIX Platforms. Swing has it own Pluggable Look & Feel (PLAF) packages which can gives you uniform look & feel over different OSes. Many other APIs were also coded at that time but none was so swift at it... so none other gained popularity.
I never claimed that Swing was based on AWT code, what I meant is that it's kind of the "next version" of AWT, if you want. It has been sped up, and as you said, now has a unified look & feel across all OS's. However, when programming in Swing, you'll sometimes have to take advantage of AWT classes, which have not been included in Swing. I don't know off the top of my head what they are, but IIRC drawing polygons still uses AWT. Not positive though. I'll look it up. Plus, Swing is more programmer-friendly and not as antiquated as AWT. AWT is ancient. :wink: