Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.awt.swing.BoxLayout
[A figure should go here.]
Instead of using BoxLayout directly, many programs use the Box class. The Box class provides a lightweight container that uses a BoxLayout. Box also provides handy methods to help you use BoxLayout well.
BoxLayout attempts to arrange components at their preferred widths (for left to right layout) or heights (for top to bottom layout). For a left to right layout, if not all the components are the same height, BoxLayout attempts to make all the components as high as the highest component. If that's not possible for a particular component, then BoxLayout aligns that component vertically, according to the component's Y alignment. By default, a component has an Y alignment of 0.5, which means that the vertical center of the component should have the same Y coordinate as the vertical centers of other components with 0.5 Y alignment.
[A figure and description should go here.]
Similarly, for a vertical layout, BoxLayout attempts to make all components in the column as wide as the widest component; if that fails, it aligns them horizontally according to their X alignments.
Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.
Field Summary | |
static int | X_AXIS
|
static int | Y_AXIS
|
Constructor Summary | |
BoxLayout(Container target,
int axis)
axis parameter.
|
Method Summary | |
void | addLayoutComponent(String name,
Component comp)
|
void | addLayoutComponent(Component comp,
Object constraints)
|
float | getLayoutAlignmentX(Container target)
|
float | getLayoutAlignmentY(Container target)
|
void | invalidateLayout(Container target)
|
void | layoutContainer(Container target)
|
Dimension | maximumLayoutSize(Container target)
|
Dimension | minimumLayoutSize(Container target)
|
Dimension | preferredLayoutSize(Container target)
|
void | removeLayoutComponent(Component comp)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int X_AXIS
public static final int Y_AXIS
Constructor Detail |
public BoxLayout(Container target, int axis)
axis
parameter.
target
- the container that needs to be laid out
axis
- the axis to lay out components along.
For left-to-right layout,
specify BoxLayout.X_AXIS
;
for top-to-bottom layout,
specify BoxLayout.Y_AXIS
axis
is invalidMethod Detail |
public void invalidateLayout(Container target)
target
- the affected container
public void addLayoutComponent(String name, Component comp)
public void removeLayoutComponent(Component comp)
public void addLayoutComponent(Component comp, Object constraints)
public Dimension preferredLayoutSize(Container target)
target
- the container that needs to be laid out
public Dimension minimumLayoutSize(Container target)
target
- the container that needs to be laid out
public Dimension maximumLayoutSize(Container target)
target
- the container that needs to be laid out
public float getLayoutAlignmentX(Container target)
target
- the container that needs to be laid out
public float getLayoutAlignmentY(Container target)
target
- the container that needs to be laid out
public void layoutContainer(Container target)
target
- the container to lay out
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |