|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
| JavaTM 2 Platform Std. Ed. v1.5.0
javax.swing
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Nested Class Summary | |
|---|---|
static class |
SpringLayout.Constraints
A Constraints object holds the
constraints that govern the way a component's size and position
change in a container controlled by a SpringLayout. |
| Field Summary | |
|---|---|
static String |
EAST
Specifies the right edge of a component's bounding rectangle. |
static String |
NORTH
Specifies the top edge of a component's bounding rectangle. |
static String |
SOUTH
Specifies the bottom edge of a component's bounding rectangle. |
static String |
WEST
Specifies the left edge of a component's bounding rectangle. |
| Constructor Summary | |
|---|---|
SpringLayout()
Constructs a new SpringLayout. |
|
| Method Summary | |
|---|---|
void |
addLayoutComponent(Component component,
Object constraints)
If constraints is an instance of
SpringLayout.Constraints,
associates the constraints with the specified component. |
void |
addLayoutComponent(String name,
Component c)
Has no effect, since this layout manager does not use a per-component string. |
Spring |
getConstraint(String edgeName,
Component c)
Returns the spring controlling the distance between the specified edge of the component and the top or left edge of its parent. |
SpringLayout.Constraints |
getConstraints(Component c)
Returns the constraints for the specified component. |
float |
getLayoutAlignmentX(Container p)
Returns 0.5f (centered). |
float |
getLayoutAlignmentY(Container p)
Returns 0.5f (centered). |
void |
invalidateLayout(Container p)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. |
void |
layoutContainer(Container parent)
Lays out the specified container. |
Dimension |
maximumLayoutSize(Container parent)
Calculates the maximum size dimensions for the specified container, given the components it contains. |
Dimension |
minimumLayoutSize(Container parent)
Calculates the minimum size dimensions for the specified container, given the components it contains. |
Dimension |
preferredLayoutSize(Container parent)
Calculates the preferred size dimensions for the specified container, given the components it contains. |
void |
putConstraint(String e1,
Component c1,
int pad,
String e2,
Component c2)
Links edge e1 of component c1 to
edge e2 of component c2,
with a fixed distance between the edges. |
void |
putConstraint(String e1,
Component c1,
Spring s,
String e2,
Component c2)
Links edge e1 of component c1 to
edge e2 of component c2. |
void |
removeLayoutComponent(Component c)
Removes the constraints associated with the specified component. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NORTH
public static final String SOUTH
public static final String EAST
public static final String WEST
| Constructor Detail |
|---|
public SpringLayout()
SpringLayout.
| Method Detail |
|---|
public void addLayoutComponent(String name, Component c)
addLayoutComponent in interface LayoutManagername - the string to be associated with the componentc - the component to be addedpublic void removeLayoutComponent(Component c)
removeLayoutComponent in interface LayoutManagerc - the component being removed from the containerpublic Dimension minimumLayoutSize(Container parent)
LayoutManager
minimumLayoutSize in interface LayoutManagerparent - the component to be laid outLayoutManager.preferredLayoutSize(java.awt.Container)public Dimension preferredLayoutSize(Container parent)
LayoutManager
preferredLayoutSize in interface LayoutManagerparent - the container to be laid outLayoutManager.minimumLayoutSize(java.awt.Container)public Dimension maximumLayoutSize(Container parent)
LayoutManager2
maximumLayoutSize in interface LayoutManager2Component.getMaximumSize(),
LayoutManagerpublic void addLayoutComponent(Component component, Object constraints)
constraints is an instance of
SpringLayout.Constraints,
associates the constraints with the specified component.
addLayoutComponent in interface LayoutManager2component - the component being addedconstraints - the component's constraintsSpringLayout.Constraintspublic float getLayoutAlignmentX(Container p)
getLayoutAlignmentX in interface LayoutManager2public float getLayoutAlignmentY(Container p)
getLayoutAlignmentY in interface LayoutManager2public void invalidateLayout(Container p)
LayoutManager2
invalidateLayout in interface LayoutManager2public void putConstraint(String e1, Component c1, int pad, String e2, Component c2)
e1 of component c1 to
edge e2 of component c2,
with a fixed distance between the edges. This
constraint will cause the assignment
value(e1, c1) = value(e2, c2) + pad
to take place during all subsequent layout operations.
e1 - the edge of the dependentc1 - the component of the dependentpad - the fixed distance between dependent and anchore2 - the edge of the anchorc2 - the component of the anchorputConstraint(String, Component, Spring, String, Component)public void putConstraint(String e1, Component c1, Spring s, String e2, Component c2)
e1 of component c1 to
edge e2 of component c2. As edge
(e2, c2) changes value, edge (e1, c1) will
be calculated by taking the (spring) sum of (e2, c2)
and s. Each edge must have one of the following values:
SpringLayout.NORTH, SpringLayout.SOUTH,
SpringLayout.EAST, SpringLayout.WEST.
e1 - the edge of the dependentc1 - the component of the dependents - the spring linking dependent and anchore2 - the edge of the anchorc2 - the component of the anchorputConstraint(String, Component, int, String, Component),
NORTH,
SOUTH,
EAST,
WESTpublic SpringLayout.Constraints getConstraints(Component c)
GridBagLayout
getConstraints method,
this method does not clone constraints.
If no constraints
have been associated with this component,
this method
returns a default constraints object positioned at
0,0 relative to the parent's Insets and its width/height
constrained to the minimum, maximum, and preferred sizes of the
component. The size characteristics
are not frozen at the time this method is called;
instead this method returns a constraints object
whose characteristics track the characteristics
of the component as they change.
c - the component whose constraints will be returned
public Spring getConstraint(String edgeName, Component c)
SpringLayout so that
the layout operation always terminates.
edgeName - must be
SpringLayout.NORTH,
SpringLayout.SOUTH,
SpringLayout.EAST, or
SpringLayout.WESTc - the component whose edge spring is desired
NORTH,
SOUTH,
EAST,
WESTpublic void layoutContainer(Container parent)
LayoutManager
layoutContainer in interface LayoutManagerparent - the container to be laid out