vienas.ch Home

 INTRODUCTION 
What is SMaker
Layout Examples
How SMaker Works
Development Issues

 MANUALS 
Installation
Using SEditor
Using the API
Example Overview

 API 
Package sm

 CONTACT 
smaker@vienas.ch
 

How SMaker Works

Any window or screen panel that contains child components like labels or input fields is modeled as a hierarchical tree of components. A feature specific to SMaker is that even the layout managers are integrated into the hierarchy.

Developing a Java Client Application

To develop a Java Application with SMaker,

  • The layout of frames, dialogs, content panes etc. is defined by SEditor and stored in one or more XML files. In many cases the entire GUI definition for an application is stored in one XML file.
  • In a second step, Java code must be written to load the layout definition (XML), and to display and use the GUI components. In the Java application, the XML may be loaded (1) from the file system, (2) from an URL or (3) from a String.
Example layout tree of a simple application:

Example Java code that uses this layout.

SMaker is quite flexible, so it is not required to build the entire GUI in SEditor. For example you could define just the layout of your main menu and the content pane of some dialogs by SEditor and build the remaining GUI completely by your own code. This means, the xml file may contain fragments of your GUI, for example menu bars, content panes together with their child components etc. To build such an xml file, put a <p> target at the top of the layout tree and append the GUI fragments as childs of this <p>. In the Java code, load the xml file, obtain references to the GUI fragments and do the usual Swing programming like adding ActionListeners etc.

Building Up the Component Tree

Multiple Layout Files

An XML file (or its Java equivalent) can contain the layout for any number of panels. If you want to have more than one layout in the file, start with a <p> node as the root. This is a general element and its role is just to be a parent of other nodes. Add the panels or frames for which the layout is specified as childs of this <p> node. However, if you need just one panel, no top <p> is required and you can start for example with a JPanel or JFrame.

Identifying Nodes

As the application program will need a reference to some (but usually not all) of the components (see Package Guide – Accessing the Swing and AWT Objects), an identifier should be set for these nodes. This is done by setting the "id" property in the Property Dialog.