public class FormLayout extends Object implements LayoutManager2
Modifier and Type | Field and Description |
---|---|
static FormConstraints |
FULL
A constraint that allows the component to use the total width of the form.
|
static FormConstraints |
FULL_FILL
A constraint that allows the component to use the total width of
the form and resizes the component to fill the whole width.
|
static FormConstraints |
LEFT
A constraint that adds the component to the left side of the form.
|
static FormConstraints |
RIGHT
A constraint that adds the component to the right side of the form.
|
static FormConstraints |
RIGHT_FILL
A constraint that adds the component to the right side of the form
and resizes the component to fill the whole available width.
|
Constructor and Description |
---|
FormLayout()
Constructs a default FormLayout without any horizontal or
vertical gaps.
|
FormLayout(int hGap,
int vGap)
Constructs a FormLayout with the specified horizontal
and vertical gap.
|
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(Component component,
Object constraints)
Adds the specified component to the layout, using the specified
constraint object.
|
void |
addLayoutComponent(String name,
Component comp)
Not used, components cannot be added without a constraint.
|
int |
getHgap()
Returns the horizontal gap between the left column
and the right column.
|
float |
getLayoutAlignmentX(Container target)
Returns the alignment along the x axis.
|
float |
getLayoutAlignmentY(Container target)
Returns the alignment along the y axis.
|
int |
getVgap()
Returns the vertical gap between the rows.
|
void |
invalidateLayout(Container target)
Invalidates the layout, indicating that if the layout manager
has cached information it should be discarded.
|
void |
layoutContainer(Container parent)
Lays out the components on the specified container.
|
Dimension |
maximumLayoutSize(Container target)
Returns the maximum size of this component.
|
Dimension |
minimumLayoutSize(Container parent)
Calculates the minimum size dimensions for the specified
panel given the components in the specified parent container.
|
Dimension |
preferredLayoutSize(Container parent)
Calculates the preferred size dimensions for the specified
container given the components in the specified parent container.
|
void |
removeLayoutComponent(Component component)
Removes the specified component and constraints from the layout.
|
void |
setConstraints(Component component,
Object constraint)
Adds the specified component to the layout, using the specified
constraint object.
|
void |
setHgap(int hGap)
Sets the horizontal gap between the left column
and the right column.
|
void |
setVgap(int vGap)
Returns the vertical gap between the rows.
|
public static final FormConstraints LEFT
public static final FormConstraints RIGHT
public static final FormConstraints RIGHT_FILL
public static final FormConstraints FULL
public static final FormConstraints FULL_FILL
public FormLayout()
public FormLayout(int hGap, int vGap)
hGap
- the horizontal gap between the left and right components.vGap
- the vertical gap between the rows.public int getHgap()
public void setHgap(int hGap)
hGap
- the horizontal gap between the columnspublic int getVgap()
public void setVgap(int vGap)
vGap
- the vertical gap between the rowspublic void setConstraints(Component component, Object constraint)
component
- the component added to the parent container.constraint
- the constraint for the added component.public void removeLayoutComponent(Component component)
removeLayoutComponent
in interface LayoutManager
component
- the component to be removedpublic Dimension preferredLayoutSize(Container parent)
preferredLayoutSize
in interface LayoutManager
parent
- the component to be laid out.public Dimension minimumLayoutSize(Container parent)
minimumLayoutSize
in interface LayoutManager
parent
- the component to be laid outpublic void layoutContainer(Container parent)
layoutContainer
in interface LayoutManager
parent
- the component which needs to be laid outpublic void addLayoutComponent(Component component, Object constraints)
addLayoutComponent
in interface LayoutManager2
component
- the component to be addedconstraints
- where/how the component is added to the layout.public Dimension maximumLayoutSize(Container target)
maximumLayoutSize
in interface LayoutManager2
target
- the component to be laid outComponent.getMinimumSize()
,
Component.getPreferredSize()
public float getLayoutAlignmentX(Container target)
getLayoutAlignmentX
in interface LayoutManager2
target
- the container to calculate X alignment for.public float getLayoutAlignmentY(Container target)
getLayoutAlignmentY
in interface LayoutManager2
target
- the container to calculate Y alignment for.public void invalidateLayout(Container target)
invalidateLayout
in interface LayoutManager2
target
- the container.public void addLayoutComponent(String name, Component comp)
addLayoutComponent
in interface LayoutManager
name
- the component name.comp
- the component.Copyright © 2002-2013 Edwin Dankert. All Rights Reserved.