• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

difference between Swing, SWT and Jfaces?

 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are these SWT and JFaces. are they enhancements of Swing. according to my knowledge Swing is enhancement of AWT.
 
author
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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" ?
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
This looks like a job for .... legal tender! It says so right in this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic