Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

AWT, Swing, SWT or JFace?  RSS feed

 
L�szl� Kov�cs
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I'm brand new to Java and I'm just reading through some books to get up to speed. I'm wondering if someone could just briefly describe the relative merits of building GUIs under each of these libraries.

Apologies if this is a common question - a quick look down the list didn't show me anything that looked like the same exact topic.
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you misunderstand the purpose of these libraries. AWT was the first set of packages that came with Java to build GUIs. Swing builds on top of that, using AWT but putting another layer over it. Swing uses lightweight components, has a lot more versatility and functionality, provides L&F support and is consistent across platforms where AWT was not. I don't know much about SWT. I don't know much about JFace either, however, as I recall it's built on top of JSP and provides a GUI element in web browsers.

So if you're asking about what to use in building a GUI for an application you can leave out JFace as it doesn't apply and you can leave out AWT as it's merely the foundation of Swing (and SWT I believe). I think that argument has more than it's share of threads around here, so look for Swing or SWT threads.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JFace is actually a layer on top of SWT. I think Ken was thinking of Java Server Faces.
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right I was.

I blame copious amounts of chocolate for the lapse.
 
L�szl� Kov�cs
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's very probable that I'm confused.

The reason that I ask is that the java book that I'm reading gives all its GUI examples using AWT. I understand that Swing is more advanced than AWT but I also seem to remember reading somewhere that Swing is less likely to be supported when using Applets - is that the case or can I just use swing with impunity?

The other thing is that I have Eclipse installed on one of the machines I'm using here and that comes with the SWT libraries. Is there any reason not to use these for application building? What about Applets?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by L�szl� Kov�cs:
It's very probable that I'm confused.

The reason that I ask is that the java book that I'm reading gives all its GUI examples using AWT. I understand that Swing is more advanced than AWT but I also seem to remember reading somewhere that Swing is less likely to be supported when using Applets - is that the case or can I just use swing with impunity?

The other thing is that I have Eclipse installed on one of the machines I'm using here and that comes with the SWT libraries. Is there any reason not to use these for application building? What about Applets?


I'd say you are reading a fairly old and outdated book. No one developes GUI applications using just AWT anymore. It's either Swing or SWT/JFace.

As far as applets are concerned it's really a non issue anymore as far as Swing is concerned. I'd recommend looking into deploying your application(s) with Java WebStart instead of via an Applet though.

You can develop Swing apps or SWT/JFace apps using Eclipse. You won't be able to create Applet with SWT/JFace because of the native library dependencies but you can Java WebStart SWT/JFace application very easily. Which GUI API you use is up to you and your application requirements. SWT/JFace vs Swing is a long and ongoing debate that has no definative answer.
 
L�szl� Kov�cs
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I'll look into WebStart - the book I'm reading is quite old but I have limited resources and it's more about the concepts than the practice so I guess I'll be reading a more up to date, practical book next.

Can anyone point me to a good place to start reading about WebStart and a well rounded debate for Swing Vs. SWT?
 
Daniel Eson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to deploy with JWS can be found here.

SWT/JFace resources here and here.
[ June 28, 2005: Message edited by: Daniel Eson ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!