layout constraint - shannah/CodeRAD GitHub Wiki

layout-constraint attribute

Synopsis

An attribute that specifies the layout constraint that is used to add the tag to its parent container. This attribute can be used on any component, and it required when adding components to certain containers - namely <border> and <borderAbsolute>. For some containers (e.g. <layered> it is optional).

Usage

The syntax of the layout constraint will depend on the type of layout that is used by the parent container.

BorderLayout Containers

When adding components to a container that uses BorderLayout, (e.g. <border>), you must includes a layout-constraint attribute to specify where, in the container, the component should appear. Possible values include north, south, east, west, center, or java:* for some java expression resolving to a valid BorderLayout constraint. E.g. java:BorderLayout.NORTH.

<border>
    <button layout-constraint="north">North button</button>
    <button layout-constraint="south">South button</button>
    <button layout-constraint="east">East button</button>
    <button layout-constraint="west">West button</button>
    <button layout-constraint="center">Center Button</button>
</border>

Examples

BorderLayout

<?xml version="1.0"?>
<border xsi:noNamespaceSchemaLocation="BorderLayoutSample.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <title>BorderLayout Sample</title>
    <button layout-constraint="north">North button</button>
    <button layout-constraint="south">South button</button>
    <button layout-constraint="east">East button</button>
    <button layout-constraint="west">West button</button>
    <button layout-constraint="center">Center Button</button>
</border>
BorderLayoutSample

See Also

⚠️ **GitHub.com Fallback** ⚠️