Class UIThreePanelLayout
public class UIThreePanelLayout extends UILayoutManager
{
// Constructors
public UIThreePanelLayout();
public UIThreePanelLayout(int hgap, int vgap);
// Methods
public void addLayoutComponent(IUIContainer cont,
IUIComponent comp, Object constraints);
public IUIComponent getComponent(Object constraints);
public IUIComponent getComponent(IUIContainer cont,
Object constraints);
public Dimension getForcedBounds(Object constraints);
public Dimension getMinimumSize(IUIContainer target);
public Dimension getPreferredSize(IUIContainer target);
public void layout(IUIContainer target, Rectangle bounds);
public void removeForcedBounds();
public void removeLayoutComponent(IUIContainer cont, IUIComponent
comp);
public void setForcedBounds(Object constraints, Dimension dim);
}
This class implements a layout manager for three panels, consisting of an image, a content component, and a set of buttons. UIThreePanelLayout lays the panels in two rows. The first row contains the image and content panels, with the image to the left of the content. The second row contains the buttons.
UIThreePanelLayout is the default layout manager for UIMessageBox, UIPropertyDialog, and UIWizard.
UILayoutManager
|
+--UIThreePanelLayout
public UIThreePanelLayout();
Creates a three-panel layout.
Remarks:
By default, the horizontal and vertical gaps (used for spacing between panels) are 7 pixels each.
public UIThreePanelLayout(int hgap, int vgap);
Creates a three-panel layout manager with the specified horizontal and vertical gaps.
Parameter | Description |
hgap
| The number of pixels used for horizontal spacing between panels.
|
vgap
| The number of pixels used for vertical spacing between panels.
|
public void addLayoutComponent(IUIContainer cont, IUIComponent comp, Object
constraints);
Adds the specified component to the container, according to the specified constraints.
Return Value:
No return value.
Parameter | Description |
cont
| The container of the component.
|
comp
| The component to be added.
|
constraints
| Identifies where the component will be added. You can pass a String or Integer value, as described in the Remarks section.
|
Remarks:
The following table lists possible values for the constraints parameter.
String value
|
Integer value
|
Component
|
"image"
|
0
|
The component to be used as the image panel, which is laid in the first row of the container, and to the left of the content panel.
|
"buttons"
|
1
|
The component to be used as the buttons panel, which is laid in the second row of the container.
|
"content"
|
2
|
The component to be used as the content panel, which is laid in the first row of the container, and to the right of the image panel.
|
Note The String values are not case-sensitive.
Overrides:
addLayoutComponent(IUIContainer,IUIComponent,Object) in UILayoutManager.
Exceptions:
IllegalArgumentException
if an undefined constraint was specified.
See Also: removeLayoutComponent
public IUIComponent getComponent(Object constraints);
Retrieves the component identified by the specified constraints.
Return Value:
Returns the specified component, if found; otherwise, returns null.
Parameter | Description |
constraints
| Identifies the component being retrieved. You can pass a String or Integer value, as described in the Remarks section.
|
Remarks:
The following table lists possible values for the constraints parameter.
String value
|
Integer value
|
Component
|
"image"
|
0
|
The component to be retrieved.
|
"buttons"
|
1
|
The component to be retrieved.
|
"content"
|
2
|
The component to be retrieved.
|
Note The String values are not case-sensitive.
Exceptions:
IllegalArgumentException
if an undefined layout name was specified.
public IUIComponent getComponent(IUIContainer cont, Object constraints);
Retrieves the component identified by the specified constraints.
Return Value:
Returns the specified component, if found; otherwise, returns null.
Parameter | Description |
cont
| The container of the component.
|
constraints
| Identifies the panel of the component to be retrieved. You can pass a String or Integer value, as described in the Remarks section.
|
Remarks:
The following table lists possible values for the constraints parameter.
String value
|
Integer value
|
Component
|
"image"
|
0
|
The component to be retrieved.
|
"buttons"
|
1
|
The component to be retrieved.
|
"content"
|
2
|
The component to be retrieved.
|
Note The String values are not case-sensitive.
Overrides:
getComponent(IUIContainer,Object) in UILayoutManager.
Exceptions:
IllegalArgumentException
if an undefined layout name was specified.
public Dimension getForcedBounds(Object constraints);
Retrieves the forced dimensions (in pixels) of the specified panel.
Return Value:
Returns a Dimension object containing the forced dimensions (if the panel has forced bounds); otherwise, returns null.
Parameter | Description |
constraints
| Identifies the panel of the component. You can pass a String or Integer value, as described in the Remarks section.
|
Remarks:
By default, a component has no forced bounds, meaning the component's preferred and minimum dimensions are used in calculating the layout's preferred and minimum layout sizes, respectively. However, you can force specific dimensions on a given component by calling setForcedBounds.
Remarks:
The following table lists possible values for the constraints parameter.
String value
|
Integer value
|
Component
|
"image"
|
0
|
The component whose dimensions are being retrieved.
|
"buttons"
|
1
|
The component whose dimensions are being retrieved.
|
"content"
|
2
|
The component whose dimensions are being retrieved.
|
Note The String values are not case-sensitive.
public Dimension getMinimumSize(IUIContainer target);
Determines the minimum dimensions (in pixels) needed to lay out the child components in the specified container.
Return Value:
Returns a Dimension object containing the minimum layout size.
Parameter | Description |
target
| The container of the components.
|
Remarks:
The layout size of the container is based on the size of each component, or panel. If any panel has forced bounds, those dimensions are used; otherwise, the minimum dimensions are used.
Because the image and content panels are laid in one row and the buttons panel in another, getMinimumSize determines the larger of the width of the buttons and the combined length of the image's width, the content's width, and the horizontal gap between the image and content. The width of the returned Dimension object is then the sum of this larger value. The Dimension object's height is the sum of the button panel's height, the larger of the heights of the image and content panels, and the vertical gap.
Overrides:
getMinimumSize(IUIContainer) in UILayoutManager.
See Also: getPreferredSize, getForcedBounds
public Dimension getPreferredSize(IUIContainer target);
Determines the preferred dimensions (in pixels) for laying out the child components in the specified container.
Return Value:
Returns a Dimension object containing the preferred layout size.
Parameter | Description |
target
| The container of the components.
|
Remarks:
The layout size of the container is based on the size of each component, or panel. If any panel has forced bounds, those dimensions are used; otherwise, the preferred dimensions are used.
Because the image and content panels are laid in one row and the buttons panel in another, getPreferredSize determines the larger of the width of the buttons and the combined length of the image's width, the content's width, and the horizontal gap between the image and content. The width of the returned Dimension object is then the sum of this larger value. The Dimension object's height is the sum of the button panel's height, the larger of the heights of the image and content panels, and the vertical gap.
Overrides:
getPreferredSize(IUIContainer) in UILayoutManager.
See Also: getMinimumSize, getForcedBounds
public void layout(IUIContainer target, Rectangle bounds);
Lays out the components in the specified container.
Return Value:
No return value.
Parameter | Description |
target
| The container being laid out.
|
bounds
| The bounding rectangle in which to lay out the components.
|
Remarks:
The image panel is laid in the top-left corner of the bounding rectangle. If the image panel has forced bounds, these dimensions are used; otherwise, the panel's preferred width and height are used.
The content panel is laid to the right of the image panel, with the horizontal gap in between them. The content's height (forced or preferred) is compared against the height of the image, and if smaller, is increased to the image's height. The content's width depends on the width of the buttons panel, which is laid below the image and content, separated by the vertical gap and left-aligned with the image. The width of the buttons panel (forced or preferred) is compared against the combined length of the image's width, the horizontal gap, and the content's width (forced or preferred), and if smaller, is increased to this combined length. Otherwise, the content's width is increased so that the combined length equals the width of the buttons panel.
Overrides:
layout(IUIContainer,Rectangle) in UILayoutManager.
See Also: getForcedBounds
public void removeForcedBounds();
Removes the forced dimensions from all panels.
Return Value:
No return value.
See Also: setForcedBounds
public void removeLayoutComponent(IUIContainer cont, IUIComponent comp);
Removes the specified component from the container.
Return Value:
No return value.
Parameter | Description |
cont
| The container of the component.
|
comp
| The component to be removed.
|
Remarks:
This method is called by the container's remove method.
Overrides:
removeLayoutComponent(IUIContainer,IUIComponent) in UILayoutManager.
See Also: addLayoutComponent
public void setForcedBounds(Object constraints, Dimension dim);
Forces the specified dimensions on the specified panel.
Return Value:
No return value.
Parameter | Description |
constraints
| Identifies the panel of the component. You can pass a String or Integer value, as described in the Remarks section.
|
dim
| The forced dimensions for the panel (in pixels).
|
Remarks:
By default, a panel has no forced bounds, meaning the panel's preferred and minimum dimensions are used in calculating the container's preferred and minimum layout sizes, respectively. However, setForcedBounds allows specific dimensions to be used.
Remarks:
The following table lists possible values for the constraints parameter.
String value
|
Integer value
|
Component
|
"image"
|
0
|
The component whose forced bounds are being set.
|
"buttons"
|
1
|
The component whose forced bounds are being set.
|
"content"
|
2
|
The component whose forced bounds are being set.
|
Note The String values are not case-sensitive.
See Also: getForcedBounds, removeForcedBounds