It's not a secret anymore!*
The moose likes Swing / AWT / SWT and the fly likes The Definitive Guide to SWT and JFace book :- Reader question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "The Definitive Guide to SWT and JFace book :- Reader question" Watch "The Definitive Guide to SWT and JFace book :- Reader question" New topic
Author

The Definitive Guide to SWT and JFace book :- Reader question

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, i have some experience on swing, can i easily to catch up SWT and Jface comcept? is this book cover for advanced reader or novice ?

can someone please explain what is SWT and Jface ? what is the good points to have SWT anf Jface ....thank you very much for your time !
Rob Warner
author
Ranch Hand

Joined: Apr 22, 2004
Posts: 50
You should be able to get up to speed on SWT and JFace with no problem, as you work through this book. It doesn't spend any time teaching Java, but it assumes no knowledge of SWT nor JFace. As a Swing developer, you're already familiar with GUI concepts, so your learning curve should not be bad at all.

In a nutshell, SWT is a widget toolkit (buttons, menus, tables, trees, et al.), that uses native widgets to ensure precise desktop integration and best performance. JFace is an abstraction layer that rides on top of SWT--sort of an MVC layer. You can use SWT without using JFace, but in many cases JFace makes development easier.
Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
Eh, not necessarily so. The biggest difference, and one which I've found to be consistenly tricky when you're out of practice, is whereas in Swing, where GUI resource management is handled automatically, in SWT and JFace, you need to allocate and release handles to manage resources.

It's just one of those things that you need to be extra-vigilant about until you get the hang of it.

RK


SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Alvin, me too... I used to do Swing in the past, especially in my universtiy life... I was even addicted to Swing GUI developement. I like the appearance of GUI and I felt like I am proud of my Swing GUI appearance, different from other students' VB project...

But when I graduated and came into the working life, Swing got no place in the industry, at least in Thailand, the country I am currently residing... But I just heard about SWT two months ago and I am really interested in that... As Mr.Rob encouragement to us(the former Swing aspirants), I got inspired by his words and started to do some little tests in SWT... I've never tried SWT before as well... I believe that in no time, I can catch up the concept of SWT...

And JFace coming together with SWT is interesting too... Such kind of abstraction does not exist in Swing...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Robert Konigsberg:
in SWT and JFace, you need to allocate and release handles to manage resources.
It's just one of those things that you need to be extra-vigilant about until you get the hang of it.


It is like C++ Windows programming technique... We need to get a handle to access resources and we need to release it, not to affect the performance of the application... So we need to manage the trade-off between performance of SWT and less resource-management property of Swing....

Just my 2 cents...
Adam Villena
Greenhorn

Joined: Jul 05, 2004
Posts: 12
Eh, not necessarily so. The biggest difference, and one which I've found to be consistenly tricky when you're out of practice, is whereas in Swing, where GUI resource management is handled automatically, in SWT and JFace, you need to allocate and release handles to manage resources.

It's just one of those things that you need to be extra-vigilant about until you get the hang of it.


Is the manual management of resources in SWT/JFace that noticeable, or it's like the thought of "creating optimized application as much as possible" makes SWT preferable that Swing? If its not that big a difference, might as well stick to Swing...? Of course, learning new things in Java would be great
Rob Warner
author
Ranch Hand

Joined: Apr 22, 2004
Posts: 50
SWT does require some manual management of resources, since the resources are actual native resources. The work is not that extensive, however, since most of what you create (e.g. buttons on a dialog) are automatically disposed when the parent is closed. When you create a resource that doesn't "belong" to another resource however, like a color or a font that you can use in many different widgets, it's up to you to dispose it manually.
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
In a nutshell, SWT is a widget toolkit (buttons, menus, tables, trees, et al.), that uses native widgets to ensure precise desktop integration and best performance. JFace is an abstraction layer that rides on top of SWT--sort of an MVC layer. You can use SWT without using JFace, but in many cases JFace makes development easier.


Mr.Rob Warner, swt is only use for desktop application right? it means swing will be replace by swt since it is faster with native code design ? please correct me ..
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
and does SWT and jFace provide API as well ? is there any formal web site for these references ?
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
i found the SWT API,

anyway, SWT only can use in desktop application ? thank you !
[ July 08, 2004: Message edited by: Alvin chew ]
Jan Rotthaus
Ranch Hand

Joined: Jun 23, 2004
Posts: 56
Hi Alvin,

yes, SWT is only for desktop applications, so no applets!

Jan


SCJP 1.4, SCJD, SCBCD 1.3, SCMAD 1.0
SCPBDA7, SCPBDP7, SCAPC8
OCUP Fundamental
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thanks, jan ..

i actually admire on netbeans IDE which provide drag n drop(VB like) interface for swing , but for SWT , is there any IDE doing it so ? thank you !
Rob Warner
author
Ranch Hand

Joined: Apr 22, 2004
Posts: 50
SWTworkbench and SWT Designer are a couple. Be sure to check Eclipse Plugin Central for a wealth of Eclipse plugins.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Jan Rotthaus:
Hi Alvin,

yes, SWT is only for desktop applications, so no applets!

Jan


But you could use SWT with Java WebStart.


GenRocket - Experts at Building Test Data
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Rob Warner:
SWTworkbench and SWT Designer are a couple.


I've just checked them out... They are not free... But there are at least trial version of SWT Designer and Open Source version of SWTworkbench for us(developers) to taste...
Jean-Francois Briere
Ranch Hand

Joined: Mar 03, 2004
Posts: 101
There is a very interesting article from IBM developerWorks that show how to create standalone SWT/JFace applications. This is a 2 parts series:
Using the Eclipse GUI outside the Eclipse Workbench
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
ko ko , i have try both jigloo and SWT designer .. for SWT designer, you need to buy a license for full function , whereas jigloo allow you try full function for the plugin ...

my personal suggestion was using jigloo plugin, which is make me feel comfortable on Swing design but for SWT , i still learning ...

anyway, thank for Mr. ROb to provide information ...
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
good link jean, i trying a sample code there , get problem in compile ..do anyone know where to get API for jFace ? thank you !

problem : FileTreeContentProvider can't resolved



i do import following :

import java.io.*;

import org.eclipse.jface.viewers.*;
import org.eclipse.jface.window.*;
import org.eclipse.swt.widgets.*;
[ July 08, 2004: Message edited by: Alvin chew ]
JiaYun Jia
Greenhorn

Joined: Jun 28, 2004
Posts: 7
Originally posted by Alvin chew:
do anyone know where to get API for jFace ? thank you !


You can get Javadoc for SWT & JFace by following this instruction.

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/faq.html#wherecanIgetJavadoc
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
refer to previous code section, i do a mistake ...forgot to code another class ....sorry ! :roll:
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thanks for the link , jiayun !

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
do anyone know how to display graph in swt ? thank you !
JiaYun Jia
Greenhorn

Joined: Jun 28, 2004
Posts: 7
Originally posted by Alvin chew:
do anyone know how to display graph in swt ? thank you !


Here's a sample code that I modified from a SWT example snippet. ( http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/snippits/snippet34.html )

 
 
subject: The Definitive Guide to SWT and JFace book :- Reader question