Which is better Java AWT or Java Swing?

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Which is better Java AWT or Java Swing?

Post 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?
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post 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
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I'd say Swing based solely on my experience in school programming with them. Swing was MUCH easier to deal with.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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.
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post 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:
Post Reply