All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.BorderLayout
java.lang.Object
|
+----java.awt.BorderLayout
- public class BorderLayout
- extends Object
- implements LayoutManager2, Serializable
A TNT style border bag layout. It will layout a container
using members named "North", "South", "East", "West" and
"Center".
When you add a component to a container that has a BorderLayout
layout manager, be sure to specify a string for where to add the
component, for example:
Panel p = new Panel();
p.setLayout(new BorderLayout());
p.add(new Button("Okay"), "South");
As a convenience, BorderLayout interprets the absence of a string
specification the same as "Center":
Panel p2 = new Panel();
p2.setLayout(new BorderLayout());
p2.add(new TextArea()); // Same as p.add(new TextArea(), "Center");
The "North", "South", "East" and "West" components get layed out
according to their preferred sizes and the constraints of the
container's size. The "Center" component will get any space left
over.
-
BorderLayout()
- Constructs a new BorderLayout with no gaps between components.
-
BorderLayout(int, int)
- Constructs a BorderLayout with the specified gaps.
-
addLayoutComponent(Component, Object)
- Adds the specified component to the layout, using the specified
constraint object.
-
addLayoutComponent(String, Component)
- Replaced by addLayoutComponent(Component, Object).
Deprecated.
-
getHgap()
- Returns the horizontal gap between components.
-
getVgap()
- Returns the vertical gap between components.
-
layoutContainer(Container)
- Lays out the specified container.
-
minimumLayoutSize(Container)
- Returns the minimum dimensions needed to layout the components
contained in the specified target container.
-
preferredLayoutSize(Container)
- Returns the preferred dimensions for this layout given the components
in the specified target container.
-
removeLayoutComponent(Component)
- Removes the specified component from the layout.
-
setHgap(int)
- Sets the horizontal gap between components.
-
setVgap(int)
- Sets the vertical gap between components.
-
toString()
- Returns the String representation of this BorderLayout's values.
BorderLayout
public BorderLayout()
- Constructs a new BorderLayout with no gaps between components.
BorderLayout
public BorderLayout(int hgap,
int vgap)
- Constructs a BorderLayout with the specified gaps.
- Parameters:
- hgap - the horizontal gap
- vgap - the vertical gap
getHgap
public int getHgap()
- Returns the horizontal gap between components.
setHgap
public void setHgap(int hgap)
- Sets the horizontal gap between components.
- Parameters:
- hgap - the horizontal gap between components
getVgap
public int getVgap()
- Returns the vertical gap between components.
setVgap
public void setVgap(int vgap)
- Sets the vertical gap between components.
- Parameters:
- vgap - the vertical gap between components
addLayoutComponent
public void addLayoutComponent(Component comp,
Object constraints)
- Adds the specified component to the layout, using the specified
constraint object.
- Parameters:
- comp - the component to be added
- constraints - where/how the component is added to the layout.
addLayoutComponent
public void addLayoutComponent(String name,
Component comp)
- Note: addLayoutComponent() is deprecated.
- Replaced by addLayoutComponent(Component, Object).
removeLayoutComponent
public void removeLayoutComponent(Component comp)
- Removes the specified component from the layout.
- Parameters:
- comp - the component to be removed
minimumLayoutSize
public Dimension minimumLayoutSize(Container target)
- Returns the minimum dimensions needed to layout the components
contained in the specified target container.
- Parameters:
- target - the Container on which to do the layout
- See Also:
- Container, preferredLayoutSize
preferredLayoutSize
public Dimension preferredLayoutSize(Container target)
- Returns the preferred dimensions for this layout given the components
in the specified target container.
- Parameters:
- target - the component which needs to be laid out
- See Also:
- Container, minimumLayoutSize
layoutContainer
public void layoutContainer(Container target)
- Lays out the specified container. This method will actually reshape the
components in the specified target container in order to satisfy the
constraints of the BorderLayout object.
- Parameters:
- target - the component being laid out
- See Also:
- Container
toString
public String toString()
- Returns the String representation of this BorderLayout's values.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index