XYLayout

XYLayout is a Borland JBuilder custom layout manager. XYLayout puts components in a container at specific x,y coordinates relative to the upper left corner of the container. Regardless of the type of display, the container will always retain the relative x,y positions of components. However, when you resize a container with an XYLayout, the components do not reposition or resize.

Example

XYLayout

You'll discover that XYLayout is very convenient to use for protoyping your design work. When you design more complicated user interfaces with multiple, nested panels, XYLayout can be used for the initial layout of the panels and components, after which you can choose from one of the standard layouts for the final design.

Note: To ensure your layout will be nicely laid out on other displays, don't leave any containers in XYLayout in your final design.

You can use the visual design tools to specify the container's size and its components' x,y coordinates.


Aligning components in XYLayout

You can adjust the alignment of a group of selected components in a container that uses XYLayout. Alignment does not work for other layouts. See Using layout managers.

With alignment operations, you can make a set of components the same width, height, left alignment, and so on, so that they look cleanly organized.

To align components,

  1. Select the components you wish to align. The order of selection affects the alignment, as described in the table below.
  2. Right click in the UI Designer and select the alignment operation you wish to perform.

Alignment options for XYLayout

The following table explains the alignment options available from the pop-up menu:

Select thisTo do this

Move to firstMove the select component to the top of the Z-order.
Move to lastMove the select component to the bottom of the Z-order.
Align LeftLine up the left edges of the components with the left edge of the first selected component.
Align CenterHorizontally line up the centers of the components with the center of the first selected component.
Align RightLine up the right edges of the components with the right edge of the first selected component.
Align TopLine up the top edges of the components with the top edge of the first selected component.
Align MiddleVertically line up the centers of the components with the middle of the first selected component.
Align BottomLine up the bottom edges of the components with the bottom edge of the first selected component.
Even Space HorizontalEvenly space the components horizontally between the first and last selected components.
Even Space VerticalEvenly space the components vertically between the first and last selected components.
Same Size HorizontalMake the components all the same width as the first selected component.
Same Size VerticalMake the components all the same height as the first selected component.


Null

Null layout means no layout manager is assigned to the container. Null layout (from Swing) is very similar to the JBCL XYLayout, in that you can put components in a container at specific x,y coordinates relative to the upper left corner of the container. You must specify each component's x,y coordinates in its constraints property.