SpeedJG Introduction - Editors Panel

Editors Panel

The Editors Panel consists of different tabs showing you the components you're currently working on. The properties of the components will be defined here and are presented in respect of the component currently being edited. For example, a JFrame editor only shows those properties that make sense for a JFrame and and not all the Component and Container properties a JFrame as inheritor hypothetically accepts.

Thus the developer of a GUI is focused on the main properties when customizing a component, and he is not overstressed with all possible properties from the inheritance hierarchy in alphabetical order. Instead, only those properties which are relevant are presented and ordered by importance.

The buttons shown on the bottom of these editor tabs refer only to the active Component being edited and have the following functions:

  • Save
    Saves the meta data into the project XML structure. Newly edited components do not become visible in the tree structure until this button has been pressed.
  • Check
    Shows the current Component on the Check Panel. If this Component is a JFrame or JDialog it is shown as a separate window. The underlying process is that these components are built up on the fly by constructing them based on their XML meta-data information.
  • Source
    Creates Java source code to build up the current Component. The source code is written on the Source Panel, and from there it can be saved as .java file or copied into your application.
  • XML
    Creates XML formatted text containing the meta data of the current Component. The text is written to the XML Panel and from there it can be copied into an XML file defining a GUI to be dynamically loaded by your application later on.
  • Exit
    Removes the current component tab from the Editors Panel.

The properties on the Editors Panel normally are self-explanatory and correspond to the properties the correlating Java Component understands. To activate a property the corresponding check boxes have to be marked.

There are, however, some virtual properties interpreted by the GUI builder to fulfill the requested feature:

Class Editor

Every Component has (and must have) a name that identifies it within the generated source code. This name becomes the variable name of the Component, and this is the name you use to fetch Components from a repository to get a reference to them.

The Dynamic check box is used to tell the GUI builder not to add this Component to its parent container but to store it in the repository in any case. So, for example, if you have a group of Components alternatively to be laid out on a container, you can mark them as Dynamic, and later on use that Component you want to be shared in a given context.

Size Ratio Editor

The SizeRatio property allows you to define the size (width and/or height) of a Component dependent on the size of its container.

X-MDR means x-axis multiply-divide ratio, and in the example above this component will become the width of one fifth of its parent container, and

Y-MDR means y-axis multiply-divide ratio, in our example half the height of the parent container.

If one of these width/height properties is not set, the corresponding Preferred Size property of the component is taken as the width or height.

The PlusX and PlusY values define how many pixels additionally should be added to (or subtracted from if negative) this width or height.

Tab Placement Editor

The Title property intrinsically belongs to the JTabbedPane, but it is defined within those Components to be added to a JTabbedPane, and is used only in this context.

This also is true for the Icon property in the above example. But I chose this example to demonstrate in general the usage of icons which are found on other property panels too. The button on the right allows you to open an embedded resource browser where you can search for icons in your file system and alternatively in your currently defined CLASSPATH. If the icon is selected from ClassPath or if you want the icon to be loaded from the ClassPath you have to mark the CP check box near the icon name. Thus you are able to deploy your icons within a .jar file and the GUI builder context and/or the generated code will load them from there.

Items Editor

While editing JList, JComboBox or JTree Components you may construct an underlying model based on a Text ItemSource or on a XMLFile ItemSource.

The example above shows how to construct a text-based DefaultTreeModel with Colors as the root node and red, green, blue as the leaves.

But like for icons you can also use the embedded resource browser to look for an XML file either in the file system or in your CLASSPATH. If you select this file the GUI builder constructs a tree model based on this XML file and visualizes all elements in it as nodes.

Remarks Editor

The Remarks property allows you to add comments to your component properties. This text is also visible as Java comment in the generated code.