javax.swing
public class BoxLayout extends Object implements LayoutManager2, Serializable
Modifier and Type | Field and Description |
---|---|
static int |
LINE_AXIS
Specifies that components are laid out in the direction of a line of text.
|
static int |
PAGE_AXIS
Sepcifies that components are laid out in the direction of the line flow.
|
static int |
X_AXIS
Specifies that components are laid out left to right.
|
static int |
Y_AXIS
Specifies that components are laid out top to bottom.
|
Constructor and Description |
---|
BoxLayout(Container container,
int way)
Constructs a
BoxLayout object. |
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(Component child,
Object constraints)
Adds a component to the layout.
|
void |
addLayoutComponent(String name,
Component component)
Adds a component to the layout.
|
float |
getLayoutAlignmentX(Container parent)
Returns the alignment along the X axis for the container.
|
float |
getLayoutAlignmentY(Container parent)
Returns the alignment along the Y axis for the container.
|
void |
invalidateLayout(Container parent)
Invalidates the layout.
|
void |
layoutContainer(Container parent)
Lays out the specified container using this layout.
|
Dimension |
maximumLayoutSize(Container parent)
Returns the maximum size of the layout gived the components
in the given container.
|
Dimension |
minimumLayoutSize(Container parent)
Returns the minimum size of the layout.
|
Dimension |
preferredLayoutSize(Container parent)
Returns the preferred size of the layout.
|
void |
removeLayoutComponent(Component component)
Removes a component from the layout.
|
public static final int X_AXIS
public static final int Y_AXIS
public static final int LINE_AXIS
public static final int PAGE_AXIS
public void addLayoutComponent(String name, Component component)
addLayoutComponent
in interface LayoutManager
name
- The name of the component to add.component
- the component to add to the layout.public void removeLayoutComponent(Component component)
removeLayoutComponent
in interface LayoutManager
component
- The component to remove from the layout.public Dimension preferredLayoutSize(Container parent)
preferredLayoutSize
in interface LayoutManager
parent
- The container that needs to be laid out.LayoutManager.minimumLayoutSize(Container)
public Dimension minimumLayoutSize(Container parent)
minimumLayoutSize
in interface LayoutManager
parent
- The container that needs to be laid out.LayoutManager.preferredLayoutSize(Container)
public void layoutContainer(Container parent)
layoutContainer
in interface LayoutManager
parent
- The container that needs to be laid out.public void addLayoutComponent(Component child, Object constraints)
addLayoutComponent
in interface LayoutManager2
child
- The component to add to the layout.constraints
- The constraints for the component in the layout.public float getLayoutAlignmentX(Container parent)
getLayoutAlignmentX
in interface LayoutManager2
parent
- The container that needs to be laid out.public float getLayoutAlignmentY(Container parent)
getLayoutAlignmentY
in interface LayoutManager2
parent
- The container that needs to be laid out.public void invalidateLayout(Container parent)
invalidateLayout
in interface LayoutManager2
parent
- The container that needs to be laid out.public Dimension maximumLayoutSize(Container parent)
maximumLayoutSize
in interface LayoutManager2
parent
- The container that needs to be laid out.Component.getMaximumSize()