|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.arch4j.ui.layout.OriginConstraint
An OriginConstraint is used with an instance of FractionalLayout to compute a Rectangle relative to a containing Rectangle, given a preferred Rectangle, by computing a relative origin and then adding an offset to it. The extent of the computed rectangle is the preferredRectangle's extent. After that explanation, I think a couple of examples are in order. Please see the documentation of the instance variables for more information.
new OriginConstraint(0.0, 0, 0.0, 0)
will place the upper-left corner of the component at the
upper-left corner (0,0) of the container. The component
will be its preferred size.
new OriginConstraint(0.0, 10, 0.5, 0)
will place the upper-left corner of the component 10 pixels
down from the top of the container, and exactly halfway
across the panel horizontally. The component will be its
preferred size.
FractionalLayout
,
AlignmentOriginConstraint
,
FrameConstraint
Field Summary | |
int |
left
Represents the number of pixels to be added as an offset to the left edge of a component. |
double |
leftFraction
A number between 0.0 and 1.0 which represents the relative fraction (of the container) for the left edge of a component. |
int |
top
Represents the number of pixels to be added as an offset to the top edge of a component. |
double |
topFraction
A number between 0.0 and 1.0 which represents the relative fraction (of the container) for the top edge of a component. |
Constructor Summary | |
OriginConstraint()
Create an instanace of an OriginConstraint. |
|
OriginConstraint(double lf,
int l,
double tf,
int t)
Create an instance of an OriginConstraint given the left fraction, the left offset, the top fraction, and the top offset. |
Method Summary | |
protected int |
adjustedLeft(Dimension containerSize)
Given a container size, resolve the left edge of a component |
Rectangle |
adjustedRectangle(Dimension containerSize,
Dimension componentSize)
Given the size of a container and the component size, return a Rectangle which appropriately bounds the component given this constraint. |
protected int |
adjustedTop(Dimension containerSize)
Given a container size, resolve the top edge of a component |
Dimension |
containSize(Dimension componentSize)
Given the size of a component, return the smallest size container which could contain it given this constraint. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public double leftFraction
public int left
public double topFraction
public int top
Constructor Detail |
public OriginConstraint()
public OriginConstraint(double lf, int l, double tf, int t)
lf
- the left fractionl
- the left offsettf
- the top fractiont
- the top offsetMethod Detail |
protected int adjustedLeft(Dimension containerSize)
containerSize
- the size of the container
public Rectangle adjustedRectangle(Dimension containerSize, Dimension componentSize)
containerSize
- the size of the containercomponentSize
- the size of the component
protected int adjustedTop(Dimension containerSize)
containerSize
- the size of the container
public Dimension containSize(Dimension componentSize)
componentSize
- the size of a component
|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |