javax.swing

Class Box

public class Box extends JComponent implements Accessible

A component that uses a {@link BoxLayout} as Layout Manager. In addition to that, this class provides a set of static methods for creating some filler components ('struts' and 'glue') for use in containers that are laid out using BoxLayout.
Nested Class Summary
protected classBox.AccessibleBox
Provides accessibility support for Boxes.
static classBox.Filler
A component that servers as a filler in BoxLayout controlled containers.
Constructor Summary
Box(int axis)
Creates a new Box component, that lays out its children according to the axis parameter.
Method Summary
static ComponentcreateGlue()
Creates a filler component which acts as glue between components.
static BoxcreateHorizontalBox()
static ComponentcreateHorizontalGlue()
Creates a filler component which acts as glue between components.
static ComponentcreateHorizontalStrut(int width)
Creates a filler component which acts as strut between components.
static ComponentcreateRigidArea(Dimension d)
static BoxcreateVerticalBox()
static ComponentcreateVerticalGlue()
Creates a filler component which acts as glue between components.
static ComponentcreateVerticalStrut(int height)
Creates a filler component which acts as strut between components.
AccessibleContextgetAccessibleContext()
voidsetLayout(LayoutManager l)

Constructor Detail

Box

public Box(int axis)
Creates a new Box component, that lays out its children according to the axis parameter.

Parameters: axis the orientation of the BoxLayout.

See Also: X_AXIS Y_AXIS LINE_AXIS PAGE_AXIS

Method Detail

createGlue

public static Component createGlue()
Creates a filler component which acts as glue between components. It does not take space unless some extra space is available. If extra space is available, this component can expand in both X and Y directions.

Returns: a glue-like filler component.

createHorizontalBox

public static Box createHorizontalBox()

createHorizontalGlue

public static Component createHorizontalGlue()
Creates a filler component which acts as glue between components. It does not take space unless some extra space is available. If extra space is available, this component can expand in the X direction.

Returns: a glue-like filler component.

createHorizontalStrut

public static Component createHorizontalStrut(int width)
Creates a filler component which acts as strut between components. It will fill exactly the specified horizontal size.

Parameters: width the width of this strut in pixels.

Returns: a strut-like filler component.

createRigidArea

public static Component createRigidArea(Dimension d)

createVerticalBox

public static Box createVerticalBox()

createVerticalGlue

public static Component createVerticalGlue()
Creates a filler component which acts as glue between components. It does not take space unless some extra space is available. If extra space is available, this component can expand in the Y direction.

Returns: a glue-like filler component.

createVerticalStrut

public static Component createVerticalStrut(int height)
Creates a filler component which acts as strut between components. It will fill exactly the specified vertical size.

Parameters: height the height of this strut in pixels.

Returns: a strut-like filler component.

getAccessibleContext

public AccessibleContext getAccessibleContext()

setLayout

public void setLayout(LayoutManager l)