|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.miginfocom.util.gfx.geometry.AlignRect
public final class AlignRect
The align rect solves the (almost) only use case that AbsRect
can't solve; aligning something that already has a certain size,
such as an image or icon within the reference rectangle.
If you have an AShape
for instance and wants to align that within some bounds, using the native size as the
size, and thus not specifying the size explicitly, as normal with AbsRect
, you should use this class.
Constructor Summary | |
---|---|
AlignRect(AtRefRangeNumber xAlign,
AtRefRangeNumber yAlign)
Constructor. |
|
AlignRect(AtRefRangeNumber xAlign,
AtRefRangeNumber yAlign,
java.awt.Insets resize)
Constructor. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
|
java.awt.Rectangle |
getRect(java.awt.Rectangle r)
Since this mothod doesn't take a referentioal size it's useless here. |
java.awt.Rectangle |
getRect(java.awt.Rectangle r,
java.awt.Dimension refSize)
Returns a rectangle that might be translated, scaled and checked for max/min bounds. |
java.awt.Insets |
getResize()
|
AtRefRangeNumber |
getXAlign()
|
AtRefRangeNumber |
getYAlign()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AlignRect(AtRefRangeNumber xAlign, AtRefRangeNumber yAlign)
xAlign
- The x alignment. E.g. AtFraction(0.5f) or AtStart(10f). Not null
.yAlign
- The y alignment. E.g. AtFraction(1f) or AtEnd(-10f). Not null
.public AlignRect(AtRefRangeNumber xAlign, AtRefRangeNumber yAlign, java.awt.Insets resize)
xAlign
- The x alignment. E.g. AtFraction(0.5f) or AtStart(10f). Not null
.yAlign
- The y alignment. E.g. AtFraction(1f) or AtEnd(-10f). Not null
.resize
- If non-null
resizes the rectangle with an absolute number of pixels at the last stage.
Positive values enlarges the rectangle. Object is cloned for local storage.Method Detail |
---|
public java.awt.Rectangle getRect(java.awt.Rectangle r)
r
is returned directly.
getRect
in interface PlaceRect
r
- Returned
public java.awt.Rectangle getRect(java.awt.Rectangle r, java.awt.Dimension refSize)
PlaceRect
getRect
in interface PlaceRect
r
- The rectangle that is to be used as the source. Not null
. Will not be changed.refSize
- If x1, y1, x2 and/or y2
is null
(in this)
) the horizontal/vertical
size if taken from this dimension instead. If null
the size is taken from r
.null
.public AtRefRangeNumber getXAlign()
public AtRefRangeNumber getYAlign()
public java.awt.Insets getResize()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |