Quick Start


  Here is a suggested plan to help you get started quickly with using Jigloo:

  1. Read the “What's new” pages for versions  3.9.0, 3.8.23.8.1, 3.8 and 3.5.

  2. Create one (or all) of the examples that are part of the Jigloo distribution - they demonstrate SWT and Swing applications, visual inheritance, use of custom classes, use of JavaBeans, etc.

  3. If you are planning to modify existing GUI classes (created either by hand or by a different GUI builder, eg JBuilder, Netbeans, etc) then read "Opening an existing GUI class".

  4. If you are working on SWT classes created using Jigloo 2.7.2, or created without Jigloo, read this section.

  5. If you are working on classes which have had Strings externalized using Jigloo 2.7.2, read this section.

  6. Otherwise, read "Creating a new GUI class".

  7. Take a quick look at how Jigloo parses your code - you don't need to understand it all right now, but you may need to come back to it later if you have code which does not seem to be being recognized by Jigloo, since understanding how Jigloo parses your code (and how you can control which code is parsed, and which classes are instantiated) will enable you to get the most out of Jigloo.

  8. If you are making an SWT class, read this section on including the SWT libraries.

  9. Familiarise yourself with the basic components of Jigloo and how to use them

  10. Look at the Useful Tips page.

Opening an existing GUI class


To open an existing Java GUI class, simply right-click on it in the Package Explorer and choose the "Open with->Form Editor" option. If you subsequently close the editor and double-click on the class in the Package Explorer it will automatically be opened with the Jigloo Form Editor.

Working on SWT classes created with older Jigloo versions, or without Jigloo

You will be able to open and modify SWT classes created with versions of Jigloo earlier than 3.0, and also with other GUI builders or by hand, but here are a few notes on code differences between the versions:

  1. SWT images/fonts/colors - in earlier versions of Jigloo, images, fonts and colors were created as fields and disposed in the DisposeListener handler which was added to the main class. In Jigloo 3.0, images, fonts and colors are handled by the SWTResourceManager.  Jigloo 3.0 offers a way to convert from using these image/font/color fields to using the SWTResourceManager, and in the process removing the fields. Simply right-click on the Form Editor, and choose the "Source->Convert to using SWTResourceManager" option.

  2. The showGUI method for SWT Composites in older versions of Jigloo contains a setSize method call to set the size of the parent Shell. This showGUI method is incompatible with Jigloo 3.0, and the setSize method will not be modified by Jigloo 3.0 when the size of the main Composite is changed in the form editor. Jigloo 3.0 offers a way to quickly insert a new showGUI method. To insert the new showGUI method, right-click on the Form Editor, and choose the "Source->Insert new showGUI method". This new showGUI will set the size of the shell automatically from the size of the Composite. You will need to manually remove the old showGUI method.

Creating a new GUI class


To start building a GUI you can either start with a new one, or start editing an existing GUI class made by a different GUI builder (eg, JBuilder or Netbeans) or by hand.


To create a new GUI class inside a Java package, right-click on the package and choose "New->Other"...



...then select "GUI Forms" in the dialog which will pop up, and choose the kind of  class you want to make (eg, SWT Composite, JFrame, etc).



This will create a new Java class file in your package, which will be opened automatically in the Jigloo GUI editor.

Jigloo's basic components


A screenshot of Jigloo (with one of many possible layout setups) editing the "FlowerShop" example is shown below. The editor has been maximized by double-clicking on the editor's tab. This is the recommended layout for GUI editing since there is no wasted space.



The screenshot shows three of the four main components of Jigloo, which are described in their own sections:



Preparing your project to use the SWT classes


If you are going to run SWT GUIs inside Eclipse then you need to make sure eclipse can find the required libraries. One way to do this is to add the required jar file(s) to your project's build path and to copy the native SWT library (or libraries) into your project.

On the Windows platform, do this:



  • right-click on your java project, choose "Properties",

  • click on the "Java Build Path" tab, then the "Libraries" tab, then the "Add External Jars" button, then

  • navigate to the  \eclipse\plugins\org.eclipse.swt.win32_n.n.n\ws\win32\ folder and choose the "swt.jar" file. (where n.n.n stands for the swt version number etc)

  • then copy the file swt-win32-nnnn.dll (which you will find in \eclipse\plugins\org.eclipse.swt.win32_n.n.n\os\win32\x86\) into your project's base directory. One way to  do this is to import the "org.eclipse.swt.win32" plugin, locate and copy the dll file and then paste it into your project.

Your project should now look something like the image to the right:

For Linux (and for other platforms it should be similar), do this:



  • right-click on your java project, choose "Properties",

  • click on the "Java Build Path" tab, then the "Libraries" tab, then the "Add External Jars" button, then

  • navigate to the  /eclipse/plugins/org.eclipse.swt.gtk_n.n.n/ws/gtk folder and choose the "swt.jar" and "swt-pi.jar" files.

  • then copy the libswt-gnome-gtk-nnnn.so, libswt-gtk-nnnn.so and libswt-pi-gtk-nnnn.so files (which you will find in /eclipse/plugins/org.eclipse.swt.gtk_n.n.n/os/linux/x86) into your project's base directory. One way to  do this is to import the "org.eclipse.swt.gtk" plugin, locate and copy the library files and then paste them into your project.

Your project should now look something like the image to the right:


When you run a class you might also need to set the java.library.path variable to point to the working directory for your project. ie, when you create a run configuration for your java class, choose the "(x)=Arguments" tab, and enter in the "VM arguments" panel a line like "-Djava.library.path=/home/jsk/eclipse/workspace/myProject".

If you use the "Run" right-click option in the Form Editor, a run configuration is created for you, and the java.library.path variable is set for you - you just need to ensure that the native libraries are in your project's working directory, and that the required jar file(s) are on your build path.