Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Awt VS Swing

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?)
 
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 69862
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Steve De Costa
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Steve De Costa
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    Bookmark Topic Watch Topic
  • New Topic