Tech. Note 6: Native SWT file/folder dialogs

The Guiffy package - the GUI application and the GUI classes in the API include the interface for utilizing Native SWT file/folder dialogs. Guiffy checks if a swt.jar is in its classpath. If so, Guiffy attempts to use the Native SWT for all its file/folder open/save dialogs. Download/Install packages are provided with the Native SWT included/configured for Windows(32 bits), MacOS X 10.7(Cocoa 64 bits), and Linux (Intel 32 bits). The following technical notes discuss how to disable the Native SWT dialogs, how to configure Native SWT dialogs on other platforms, and how to enable Native SWT dialogs using the GuiffyInside API.

MacOS X download install packages beginning with Guiffy 11.0 do not include/enable SWT. The Oracle OpenJDK 1.7 and 1.8 Java releases for MacOS X do not work with SWT. If/When SWT is working with a current Java release on MacOS X, we will include SWT in our MacOS X download/intall packages.

How to disable SWT Native dialogs

To disable Native SWT file/folder dialogs (and revert to using Swing's file/folder dialogs), two techniques are available. The guiffy command line option -dswtoff will disable SWT dialogs for that execution. Edit the guiffy.lax in Guiffy's install folder, change:
lax.command.line.args=com.guiffy.guiffy.GuiffyCLI $CMD_LINE_ARGUMENTS$
to:
lax.command.line.args=com.guiffy.guiffy.GuiffyCLI -dswtoff $CMD_LINE_ARGUMENTS$
-OR-
Remove the swt.jar file from Guiffy's classpath. For the Guiffy GUI application this is accomplished by editing the guiffy.lax file in Guiffy's install folder.
Edit guiffy.lax, change the LAX.CLASS.PATH line from:
lax.class.path=Guiffy.jar;.;jh.jar;swt.jar;lax.jar
to:
lax.class.path=Guiffy.jar;.;jh.jar;lax.jar
And rename the swt.jar file in the install folder to swt.off (or something like that - so, it will not be recognized as a jar file).

How to configure SWT dialogs on other platforms

First download the swt.jar for your platform and JRE. SWT downloads packages are available at:
http://www.eclipse.org/swt/
Then, save the swt.jar in Guiffy's install folder. And add the swt.jar to Guiffy's classpath by editing the .lax file lax.class.path property.

On some systems you may also need to add 2 jna lib .jar files from the DJ Swing project to Guiffy's classpath. We found these jna lib .jar files were required for some Linux distributions. The DJ Swing project's download package is at:
http://djproject.sourceforge.net/swingsuite/index.html
The 2 jna lib jar files (jna-3.2.4.jar and jna_WindowUtils.jar) are located in the DJ Swing lib/ folder.

If you need further help getting SWT configured, send us an email at with information about your platform, JRE, and the problem or questions you have. We will help you resolve the issue(s) and then we'll share the solution with everyone else here.

How to enable SWT dialogs from GuiffyInside API

First we recommend testing the Native SWT file/folder dialogs setup from the Guiffy GUI application. Then, enable and test the SWT dialogs in your application using GuiffyFrame or GuiffyPanel of the GuiffyInside API.

GuiffyFrame and GuiffyPanel are enabled to utilize Native SWT dialogs in the same manner as the Guiffy GUI application. Simply include the swt.jar (and if required on your platform, the 2 jna lib .jar files) in the classpath for your application.

Documentation by Guiffy Software, Inc. 2014