7 Replies - 6129 Views - Last Post: 13 July 2010 - 08:12 PM Rate Topic: -----

#1 gretty  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 123
  • Joined: 25-May 09

Learning Java GUI: AWT or Swing

Posted 13 July 2010 - 08:03 PM

Hello

I am learning Java & I want to start learning how to make applications (not console programs) in Java.

So I have done some research & I have come across Swing & the AWT library( is AWT Applet ???).

For a beginner, what should I learn 1st:
- Making GUI applications using Swing
OR
- Making GUI applications using AWT


Also what is the difference between the 2 libraries(Swing & AWT)? Is AWT like win32 & is Swing like .net?

Plus anyone know of some good GUI Java tutorial sites? :)

Thanks for your time

Is This A Good Question/Topic? 1
  • +

Replies To: Learning Java GUI: AWT or Swing

#2 bcranger  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 252
  • View blog
  • Posts: 1,199
  • Joined: 01-February 10

Re: Learning Java GUI: AWT or Swing

Posted 13 July 2010 - 08:07 PM

Learn swing, awt is outdated.

Follow this guide:

http://download.orac...torial/uiswing/
Was This Post Helpful? 0
  • +
  • -

#3 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1949
  • View blog
  • Posts: 4,048
  • Joined: 11-December 07

Re: Learning Java GUI: AWT or Swing

Posted 13 July 2010 - 08:09 PM

Short answer:

Learn swing.
Sun has an awesome tutorial. This is a brief intro with a link to the full version:
http://download.orac...l/ui/index.html

AWT is not outdatad, rather it serves a different purpose. However, swing is more fully-featured.
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10447
  • View blog
  • Posts: 38,690
  • Joined: 27-December 08

Re: Learning Java GUI: AWT or Swing

Posted 13 July 2010 - 08:09 PM

AWT was the original GUI Framework for Java. It relied on the native system to paint(), which caused a lot of platform-specific behaviors and bugs that went against the Java design of cross-platform compatability. It was also limited b/c it was designed for a least-common denominator solution. That is, everything that was supported on all major platforms was part of the AWT Framework, leaving a featureless and sparse GUI framework. Swing evolved from AWT, with the major difference being that Swing handles its own painting, making the designs more standard and reducing many of those bugs. However, the consequence is that Swing isn't Thread-safe. Plus, Swing comes with more helpful features and components that AWT lacks (like JTable, JTree, JProgressBar, etc.), and is easier to use. In regards to Applets, Swing has JApplet which will work just fine. So I would reccomend Swing.

As for tutorials, we have plenty of good tutorials in the Java Tutorials Section.

@cfoley: If you aren't accessing listeners, Color, Graphics or maybe a couple other utility components, then steer clear of AWT. It is otherwise a quite dead GUI Framework.
Was This Post Helpful? 1
  • +
  • -

#5 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Learning Java GUI: AWT or Swing

Posted 13 July 2010 - 08:10 PM

Swing... for the time it will last
No new development in pure AWT since the last 6 years unless you have a real performance problem
Was This Post Helpful? 0
  • +
  • -

#6 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2870
  • View blog
  • Posts: 11,025
  • Joined: 15-July 08

Re: Learning Java GUI: AWT or Swing

Posted 13 July 2010 - 08:11 PM

Swing is a newer framework; AWT (Abstract Windowing Kit) is older. AWT is heavyweight and native, thus limiting the number of components that can be supported cross-platform. Swing is newer and has many, many more components than AWT does, however many things are similar between the two (events for one). You can think of Swing as a newer, more modern version of AWT.

As for which one to learn first? I actually suggest learning Swing. While learning it, you will also have to learn about AWT, as many packages are shared. The one thing that I suggest you not do is mix AWT COMPONENTS and Swing COMPONENTS.
Was This Post Helpful? 0
  • +
  • -

#7 Luckless  Icon User is offline

  • </luck>
  • member icon

Reputation: 292
  • View blog
  • Posts: 1,146
  • Joined: 31-August 09

Re: Learning Java GUI: AWT or Swing

Posted 13 July 2010 - 08:12 PM

Swing is what you should learn. It is the standard format for Applets because it uses the same components that Java Applications use such as JLabel and JButton where as AWT is not. AWT is just outdated, that is all. Google is a great place to start. :bigsmile: happy coding
Was This Post Helpful? 0
  • +
  • -

#8 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Learning Java GUI: AWT or Swing

Posted 13 July 2010 - 08:12 PM

View Postbcranger, on 13 July 2010 - 09:07 PM, said:

Learn swing, awt is outdated.

I wouldn't say outdated as many Swing component rely on their AWT counterpart
If you need real performance Canvas is still the best solution for game programming
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1