|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--attachlayout.AttachLayout.Constraints
Defines constraints by specifying an anchor, connection type and offset for every side of the component to lay out. Can only be used in containers with an AttachLayout layout manager.
Constructor Summary | |
AttachLayout.Constraints()
Constructs a new Constraints object. |
Method Summary | |
void |
addToColumn(java.lang.String boxName,
boolean leftElastic,
int leftOffset,
boolean rightElastic,
int rightOffset)
Attaches a component's left and right side to the left and right side of the specified box. |
void |
addToRow(java.lang.String boxName,
boolean topElastic,
int topOffset,
boolean bottomElastic,
int bottomOffset)
Attaches a component's top and bottom side to the top and bottom side of the specified box. |
void |
attachNone(int side)
Sets a side to be attached to nothing. |
void |
attachToBorder(int side,
boolean elastic,
int offset)
Attaches a component's side to the container's border. |
void |
attachToBox(int side,
boolean elastic,
int offset,
java.lang.String boxName,
int anchorSide)
Attaches a component's side to a box defined in the same container. |
void |
attachToComponent(int side,
boolean elastic,
int offset,
java.awt.Component anchor,
int anchorSide)
Attaches a component's side to another component in the same container. |
void |
attachToComponents(int side,
boolean elastic,
int offset,
java.awt.Component[] anchors,
int anchorSide)
Deprecated. use AttachLayout.defineBox(java.lang.String, attachlayout.AttachLayout.Constraints) and attachToBox(int, boolean, int, java.lang.String, int) , addToColumn(java.lang.String, boolean, int, boolean, int) or addToRow(java.lang.String, boolean, int, boolean, int) instead. |
void |
attachToRelativePosition(int side,
boolean elastic,
int offset,
int percentage)
Sets a side to be attached to a relative position. |
void |
setHorizontalAlignment(int percentage)
Sets the alignment in case both left and right connection types are set to elastic. |
void |
setMinimumHeight(int height)
Sets the minimum height for the attached component. |
void |
setMinimumWidth(int width)
Sets the minimum width for the attached component. |
void |
setPreferredHeight(int height)
Sets the preferred height for the attached component. |
void |
setPreferredWidth(int width)
Sets the preferred width for the attached component. |
void |
setVerticalAlignment(int percentage)
Sets the alignment in case both top and bottom connection types are set to elastic. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AttachLayout.Constraints()
Method Detail |
public void attachToBorder(int side, boolean elastic, int offset)
side
- the side of the component to attach to the container's border.
One of TOP, LEFT, BOTTOM, RIGHT.elastic
- when true, the offset defines a minimum offset,
when false the offset defines an exact offset.offset
- number of pixels to offset from the anchor.
Positive offsets are defined as pointing to the given side of the
component. Thus a positive left offset moves the component's left side to
the right while a positive right offset moves the component's right side
to the left.java.lang.IllegalArgumentException
- when side is not a valid side.public void attachToComponent(int side, boolean elastic, int offset, java.awt.Component anchor, int anchorSide)
side
- the side of the component to attach to the other component.
One of TOP, LEFT, BOTTOM, RIGHT.elastic
- when true this attachment defines a minimum offset,
when false the attachment defines an exact offset.offset
- number of pixels to offset from the anchor.
Positive offsets are defined as pointing from the anchor to the component.
Thus a positive left offset moves the component's left side to the right
while a positive right offset moves the component's right side to the left.anchor
- the component to attach to.anchorSide
- the side of the anchor to attach to. One of
TOP, LEFT, BOTTOM, RIGHT.java.lang.IllegalArgumentException
- when an invalid side or anchorSide is
given. A left or right side can only be attached to another component's
left or right side. A top or a bottom side can only be attached to another
component's top or bottom side.public void attachToBox(int side, boolean elastic, int offset, java.lang.String boxName, int anchorSide)
side
- the side of the component to attach to the other component.
One of TOP, LEFT, BOTTOM, RIGHT.elastic
- when true this attachment defines a minimum offset,
when false the attachment defines an exact offset.offset
- number of pixels to offset from the anchor.
Positive offsets are defined as pointing from the anchor to the component.
Thus a positive left offset moves the component's left side to the right
while a positive right offset moves the component's right side to the left.boxName
- the name of the box to attach to.anchorSide
- the side of the anchor to attach to. One of
TOP, LEFT, BOTTOM, RIGHT.java.lang.IllegalArgumentException
- when an invalid side or anchorSide is
given. A left or right side can only be attached to another component's
left or right side. A top or a bottom side can only be attached to another
component's top or bottom side.public void attachToComponents(int side, boolean elastic, int offset, java.awt.Component[] anchors, int anchorSide)
AttachLayout.defineBox(java.lang.String, attachlayout.AttachLayout.Constraints)
and attachToBox(int, boolean, int, java.lang.String, int)
, addToColumn(java.lang.String, boolean, int, boolean, int)
or addToRow(java.lang.String, boolean, int, boolean, int)
instead.
side
- the side of the component to attach to the other component.
One of TOP, LEFT, BOTTOM, RIGHT.elastic
- when true this attachment defines a minimum offset,
when false the attachment defines an exact offset.offset
- number of pixels to offset from the anchor.
Positive offsets are defined as pointing from the anchor to the component.
Thus a positive left offset moves the component's left side to the right
while a positive right offset moves the component's right side to the left.anchors
- a valid array of valid components to attach to.
The components must be in the same container as the component being
attached.anchorSide
- the side of the anchors to attach to. One of
TOP, LEFT, BOTTOM, RIGHT. If anchorSide is LEFT, the final anchor position
will be the leftmost left side of the components specified as anchors. If
anchorside is RIGHT, the final anchor position will
be the rightmost right side of the components specified as anchors.
The same principle holds for TOP or BOTTOM attachments.java.lang.IllegalArgumentException
- when an invalid side or anchorSide is
given. A left or right side can only be attached to another component's
left or right side. A top or a bottom side can only be attached to another
component's top or bottom side.public void attachNone(int side)
side
- the side of the component set free. One of
TOP, LEFT, BOTTOM, RIGHT.java.lang.IllegalArgumentException
- when an invalid side is given.public void attachToRelativePosition(int side, boolean elastic, int offset, int percentage)
side
- the side of the component to attach to the relative position.
One of TOP, LEFT, BOTTOM, RIGHT.elastic
- when true this attachment defines a minimum offset,
when false the attachment defines an exact offset.offset
- number of pixels to offset from the anchor.
Positive offsets are defined as pointing from the anchor to the component.
Thus a positive left offset moves the component's left side to the right
while a positive right offset moves the component's right side to the left.percentage
- the relative position in percentages; 0 is the left or
top layout border of the container, 100 is the right or bottom layout border.java.lang.IllegalArgumentException
- when an invalid side or an invalid
percentage is given.public void addToColumn(java.lang.String boxName, boolean leftElastic, int leftOffset, boolean rightElastic, int rightOffset)
boxName
- the name of box to position the component in horizontally.leftElastic
- defines the nature of the left attachment, true to define a minimum offset, false to define an exact offset.leftOffset
- number of pixels to offset on the left side.rightElastic
- defines the nature of the right attachment, true to define a minimum offset, false to define an exact offset.rightOffset
- number of pixels to offset on the right side.public void addToRow(java.lang.String boxName, boolean topElastic, int topOffset, boolean bottomElastic, int bottomOffset)
boxName
- the name of box to position the component in vertically.topElastic
- defines the nature of the top attachment, true to define a minimum offset, false to define an exact offset.topOffset
- number of pixels to offset on the top side.bottomElastic
- defines the nature of the bottom attachment, true to define a minimum offset, false to define an exact offset.bottomOffset
- number of pixels to offset on the bottom side.public void setPreferredWidth(int width)
width
- the preferred width for the attached component. Specifying
COMPONENT_PREFERRED indicates the preferred width of the component.public void setPreferredHeight(int height)
height
- the preferred height for the attached component. Specifying
COMPONENT_PREFERRED indicates the default preferred height of the
component.public void setMinimumWidth(int width)
width
- the minimum width for the attached component. Specifying
COMPONENT_PREFERRED indicates the minimum width of the component.public void setMinimumHeight(int height)
height
- the minimum height for the attached component. Specifying
COMPONENT_PREFERRED indicates the default minimum height of the
component.public void setVerticalAlignment(int percentage)
percentage
- indicates the percentage of free space to add to the
front side offset, (0 <= percentage <= 100).public void setHorizontalAlignment(int percentage)
percentage
- indicates the percentage of free space to add to the
front side offset, (0 <= percentage <= 100).
|
Copyright © 2003-2008, Paul Neyens All Rights Reserved. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |