BorderContainer is a WidgetContainer which may have up to five children: one along each edge, and a fifth
one in the center. When this container is resized, the center component grows to take up as much space
as possible.
In addition to the event types generated by all Widgets, BorderContainers generate the following event types:
add
public void add(Widget widget,
BorderContainer.Position where)
Add a Widget to this container, using the default LayoutInfo to position it.
widget
- the Widget to addwhere
- the location to add it (CENTER, NORTH, EAST, SOUTH, or WEST)
add
public void add(Widget widget,
BorderContainer.Position where,
LayoutInfo layout)
Add a Widget to this container.
widget
- the Widget to addwhere
- the location to add it (CENTER, NORTH, EAST, SOUTH, or WEST)layout
- the LayoutInfo to use for this Widget. If null, the default LayoutInfo will be used.
getChild
public Widget getChild(BorderContainer.Position where)
Get the child in a particular location.
where
- the location of the Widget to get (CENTER, NORTH, EAST, SOUTH, or WEST)
getChildLayout
public LayoutInfo getChildLayout(BorderContainer.Position where)
Get the LayoutInfo for the Widget in a particular location.
where
- the location of the Widget (CENTER, NORTH, EAST, SOUTH, or WEST)
- the LayoutInfo being used for that Widget. This may return null, which indicates that the
default LayoutInfo is being used.
getChildLayout
public LayoutInfo getChildLayout(Widget widget)
Get the LayoutInfo for a particular Widget.
widget
- the Widget for which to get the LayoutInfo
- the LayoutInfo being used for that Widget. This may return null, which indicates that the
default LayoutInfo is being used. It will also return null if the specified Widget is not
a child of this container.
getChildPosition
public BorderContainer.Position getChildPosition(Widget widget)
Get the Position of a particular Widget.
widget
- the Widget for which to get the Position
- the Position at which that Widget is located, or null if the specified Widget is not
a child of this container.
getChildren
public Collection getChildren()
Get a Collection containing all child Widgets of this container.
- getChildren in interface WidgetContainer
getComponent
public JPanel getComponent()
Get the java.awt.Component corresponding to this Widget.
- getComponent in interface Widget
getCornersAreVertical
public boolean getCornersAreVertical()
Get whether the vertical Widgets (EAST and WEST) or the horizontal Widgets (NORTH and SOUTH) extend
all the way to the corners.
getDefaultLayout
public LayoutInfo getDefaultLayout()
Get the default LayoutInfo.
getMinimumSize
public Dimension getMinimumSize()
Get the smallest size at which this Widget can reasonably be drawn. When a WidgetContainer lays out
its contents, it will attempt never to make this Widget smaller than its minimum size.
- getMinimumSize in interface Widget
getPreferredSize
public Dimension getPreferredSize()
Get the preferred size at which this Widget will look best. When a WidgetContainer lays out
its contents, it will attempt to make this Widget as close as possible to its preferred size.
- getPreferredSize in interface Widget
layoutChildren
public void layoutChildren()
Layout the child Widgets. This may be invoked whenever something has changed (the size of this
WidgetContainer, the preferred size of one of its children, etc.) that causes the layout to no
longer be correct. If a child is itself a WidgetContainer, its layoutChildren() method will be
called in turn.
- layoutChildren in interface WidgetContainer
remove
public void remove(BorderContainer.Position where)
Remove a child Widget from this container.
where
- the location of the Widget to remove (CENTER, NORTH, EAST, SOUTH, or WEST)
remove
public void remove(Widget widget)
Remove a child Widget from this container.
- remove in interface WidgetContainer
widget
- the Widget to remove
setChildLayout
public void setChildLayout(BorderContainer.Position where,
LayoutInfo layout)
Set the LayoutInfo for the Widget in a particular location.
where
- the location of the Widget (CENTER, NORTH, EAST, SOUTH, or WEST)layout
- the new LayoutInfo. If null, the default LayoutInfo will be used.
setChildLayout
public void setChildLayout(Widget widget,
LayoutInfo layout)
Set the LayoutInfo for a particular Widget.
widget
- the Widget for which to set the LayoutInfolayout
- the new LayoutInfo. If null, the default LayoutInfo will be used.
setCornersAreVertical
public void setCornersAreVertical(boolean vertical)
Set whether the vertical Widgets (EAST and WEST) or the horizontal Widgets (NORTH and SOUTH) extend
all the way to the corners.
setDefaultLayout
public void setDefaultLayout(LayoutInfo layout)
Set the default LayoutInfo.