aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Awt VS Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Awt VS Swing" Watch "Awt VS Swing" New topic
Author

Awt VS Swing

Steve De Costa
Ranch Hand

Joined: Jun 04, 2007
Posts: 33
What's the difference between AWT and Swing toolboxes.

I am trying to make a user interface for my program that displays some graphs.

Which one would you gus recommend I use? (and why?)
Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

Swing's are light weight component but,AWT is heavy weighted one.

To be more appropriate

Swing is pure java(i.e.,) what ever you create using swing Component will get created by java only and it is independent of Operating System(OS).On the other hand AWT uses native method to create Components for your application which makes it dependent on OS.

In case of performance,AWT wins over Swing.Because, the fact that swing is pure java which make a additional burden for the java to take care of swing components which surely affects java application performance for a bit.While,AWT Components are native methods which makes it less burden over Swing.

I recommend you not to mix both the AWT and Swing Component in your code.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38765
    
  23
Swing, not Swings.

Most people would use Swing because it allows you to specify a "look-and-feel." AWT components take the same look-and-feel as the operating system. For a user interface the slowest component of the process is the hand-to-mouse or hand-to-keyboard motion!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14144
    
  18

AWT is the old GUI toolkit that came with Java versions 1.0 and 1.1 (a long time ago). In Java 1.2, Swing was added.

For new software, use Swing, not just AWT.

See the tutorial: Creating a GUI with JFC/Swing


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

AWT often looks more bland, but more important, it lacks native (i.e. Sun provided) support for more advanced controls such as tables and trees.
On the other hand, (nearly) every AWT control has a matching class in Swing, often using the same name but with a "J" in front of it. One notable exception is Choice vs JComboBox.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Steve De Costa
Ranch Hand

Joined: Jun 04, 2007
Posts: 33
Is is true though that applets can only be made with awt and not SWING?

or applets can be made through SWIng as well.

Can anyone please send me a some small and good tutorial for Swing. I looked at the tutorial from sun at SUN's Swing Tutorial and they mostly tell us how to add gui using net beans. Not too much code especially for listeners..



Appreciate your help.

Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

Originally posted by Steve De Costa:
Is is true though that applets can only be made with awt and not SWING?

or applets can be made through SWIng as well.

Here's a hint: JApplet
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Here is the TOC for the Swing Trail where you saw the Netbeans stuff. Clearly you just didn't take time to look through it. There is only one small section on using Netbeans.


GenRocket - Experts at Building Test Data
Steve De Costa
Ranch Hand

Joined: Jun 04, 2007
Posts: 33
Thanks Rob Prime. That clears out the doubt.

Gregg Bolinger, I couldn't get to that part, though I did look quite long enough everywhere on the net for a good SWING Tutorial.

Thanks everyone for your help.

Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Awt VS Swing