Java Gui Builder
You are here: Home   >   Documentation   >   JGB Elements Documentation   >   Constraints Element
JGB Element Navigation
tab
ref

Constraints Element

Group membership: Layout control

constraints elements describe constraints used when adding components to a container. When constraints elements are encountered, JGB saves the constraints' value ( ref, constant, value, return or gridbag) until such a time it will add a component.

At that time, JGB will get the current constraints and pass the saved object reference to the container's add(Component, Object) method.

The current constraints are cleared whenever the current window ends (when JGB encounters a closing window element), or when the reset attribute contains true.

Attributes

Name Type Required Description
reset CDATA No

Instructs JGB to forget any references to the current constraints so that the next component additions will be done constraints-less.

Literal values

Value Description
false

Do not reset the constraints.

true

Reset the constraints.

Example usage

…
<layout class="java.awt.BorderLayout"/>
    <constraints>
        <constant name="java.awt.BorderLayout.NORTH"/>
    </constraints>
    <!-- Insert a control into the parent container which is laid out using
        a BorderLayout class. -->
    <control …/>

    <!-- Reset the constraints so that there are none anymore -->
    <constraints reset="true"/>

    <!-- This control will be added without constraints to the parent container -->
    <control …/>
    …
<layout/>
        

Parent element(s)

controls, control, panel, tab.

Child element(s)

constant, gridbag, null, ref, return, value.
Back to top
SourceForge Logo
Hosted on SourceForge.net
Valid XHTML 1.0!
Valid XHTML 1.0 !
Valid CSS!
Valid CSS !
Code Coverage by Clover
Code Coverage provided by Clover
 |  Home |  License |  Downloads |  Documentation |  Developers |  Mailing Lists |  Dependencies |  Links |  Privacy Policy |  SF Project Home |