Using gui4j, the complete graphical user interface is defined in xml. The xml definitions refer to methods and instances in […]



The graphical user interface is created dynamically based on the XML definitions. Each GUI window is associated with exactly one top-level XML file. Each XML file can dynamically include other XML files to support complex GUI definitions. Each XML file is associated with a java object that acts as both a Controller and a Model for the GUI. There is a strong layer separation between the GUI and the Controller: GUI definitions in the XML files can access all Java methods of the Controller, but Java methods cannot access any GUI elements directly. Events are used to trigger changes in the GUI.


The complete source code of the following quickstart example is contained in the folder org/gui4j/doc/examples/quickstart in the zip file

The example can be run with the command:java -cp gui4j.jar;examples.jar org.gui4j.doc.examples.quickstart.Main

One of the first things you must do is to initialize gui4j. For initialization a properties file with all possible components is necessary. The syntax is

xmlTagName = gui4jFactoryClassName

The components are initialized lazy on first use. The file contains the current list of all supported components.