Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2007

Tip: Looking for answers? Try searching our database.

AWT versus Swing

Thread view: 
Daniel Kraft - 15 Jun 2007 17:45 GMT
Hi all,

I apologize as I believe this could probably be a very common question.
But I wasn't able to find *really* what I was looking for searching the
internet so far.

I've all times used AWT for UIs in Java, despite the fact that all the
other world seems to be using Swing.  I do not really "need" these fancy
Java-look and instead prefer the plain, platform-common look instead;
also, I think Swing is really sensible slower than AWT and if your
platform already has fast and stable widgets, why not use them?

On the other hand, I already read some rumours that AWT will be
deprecated somewhere in the future, which I can't believe as Swing is
based on AWT, AFAIK.

So do you guys have any information/comments/corrections about my
assumptions or any real objections against using AWT or are there even
others who prefer AWT, too?

Yours,
Daniel

Signature

Got two Dear-Daniel-Instant Messages
by MSN, associate ICQ with stress --
so please use good, old E-MAIL!

Roedy Green - 16 Jun 2007 00:23 GMT
>So do you guys have any information/comments/corrections about my
>assumptions or any real objections against using AWT or are there even
>others who prefer AWT, too?

Other than the plainer look, AWT is based on using peer components.
That means your program will look and feel different on different
platforms. It will have different bugs.

I am gradually flipping my old AWT apps to Swing.  With Microsoft
pushing people toward Vista, they are also pushing out the old MS and
Sun Javas.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Andrew Thompson - 16 Jun 2007 02:43 GMT
...
>I've all times used AWT for UIs in Java, despite the fact that all the
>other world seems to be using Swing.  I do not really "need" these fancy
>Java-look and instead prefer the plain, platform-common look instead;

I often call the platform's default PLAF - so
the end user can feel mostly at home, while also
enjoying the benefits of such GUI components
as JTables and JTrees.  From the development
side, I like the 'throw away simplicity' of JOptionPane,
and the ease of developing using GUI components
that will render HTML.

I code AWT as well, but primarily for applets that
must be 1.1 compatible (I write too many of those,
it seems).  Any 1.2+ project, I would generally use
Swing.

>also, I think Swing is really sensible slower than AWT ..

Is it?  Even if Swing components need 'a few microseconds'
longer to construct* these sorts of things can mostly be done
transparently on a thread in the background.  

Once constructed and displayed, I find Swing components
every bit as fast as AWT, to show, hide or update.

* I am not too sure, have not seen/done any benchmarks.

>..and if your
>platform already has fast and stable widgets, why not use them?

Roedy put forward some good reasons, not that
Swing and PLAF's are a rock solid solution either
(I suspect every API has bugs).

>On the other hand, I already read some rumours that AWT will be
>deprecated somewhere in the future, which I can't believe as Swing is
>based on AWT, AFAIK.

I cannot imagine that AWT ..Buttons and TextFields
would *ever* be removed from the API.  And, as you
noticed, a lot of a Swing GUI's functionality (most
events, most layouts, colors, images, printing, basic
D'n'D, graphics/environment..) uses AWT classes and
packages.

>So do you guys have any information/comments/corrections about my
>assumptions or any real objections against using AWT or are there even
>others who prefer AWT, too?

Most people are coding for the server side,
very little AWT/Swing/SWT or J2ME, but by
far Swing is the chosen widget kit.  One good
reason is that if you ask people about a problem
with Swing, you are much likely to find someone
that knows the answer!  A lot of people have
forgotten the 'subtleties' of AWT GUI coding.

Signature

Andrew Thompson
http://www.athompson.info/andrew/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.