my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes difference between Swing, SWT and Jfaces? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "difference between Swing, SWT and Jfaces?" Watch "difference between Swing, SWT and Jfaces?" New topic
Author

difference between Swing, SWT and Jfaces?

yamini nadella
Ranch Hand

Joined: Apr 13, 2004
Posts: 257
What are these SWT and JFaces. are they enhancements of Swing. according to my knowledge Swing is enhancement of AWT.
Scott Delap
author
Ranch Hand

Joined: Apr 05, 2005
Posts: 73
AWT was the original UI toolkit included in Java. It makes use of native peers for UI components. Swing takes a different approach by implementing all of its components with pure Java code. Swing uses a few portions of AWT such as the top level window containers and the AWT mechanisms for collecting input events such as mouse and keyboard clicks. However, it does not make use of the AWT components themselves.

http://www.javaworld.com/javaworld/jw-01-1998/jw-01-jfc.html

SWT uses a native peer approach similar to AWT. There is a JNI accessed layer that is different for each OS supported by SWT that contains peers for native components. So the SWT Table class ultimately delegates the majority of its functionality to the native Windows table component for instance. JFace is a layer built on top of SWT that simplifies common UI programming tasks and promotes a model based structure for using SWT components.

http://www.javaworld.com/javaworld/jw-04-2004/jw-0426-swtjface.html

http://www.martinfowler.com/eaaCatalog/modelViewController.html

Scott Delap
ClientJava.com
Desktop Java Live
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
I havent been able to figure out what makes JFACE any easier to implement than SWT. It seems like it only saves you a few lines of code here and there. For example, JFace claims to streamline event handling by implementing the Action Class. But how is adding an "action class" any less tedious than adding an "action listener" ?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by JAY asasd:
I havent been able to figure out what makes JFACE any easier to implement than SWT. It seems like it only saves you a few lines of code here and there. For example, JFace claims to streamline event handling by implementing the Action Class. But how is adding an "action class" any less tedious than adding an "action listener" ?


For 1, and this applies to Swing also, Action classes are reuasable. Instead of writing the actionPerformed (Swing) method for every button give the button an instance of your action class.

The other thing JFace does is it takes care of all the garbage collection for you that you have to do manually in SWT. Remember that in SWT you have to manually dispose of certain components because they are drawn by the OS and the VM's GC has no control over them.

There is a bit of window creation code that is taken care of for you. Complex components like Tables and their models are better in JFace. Just things like that are what I think make JFace easier to use. Although remember also that JFace couldn't exist without SWT. If you look at the JFace classes, they are all SWT internally. So they saved you from having to implement all those JFace classes manually.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between Swing, SWT and Jfaces?