com.google.code.validationframework.swing.decoration.anchor
Class Anchor

java.lang.Object
  extended by com.google.code.validationframework.swing.decoration.anchor.Anchor

public class Anchor
extends Object

Entity representing an anchor.
An anchor is, for instance, a virtual point on a component relatively to its bounds, and can be used as the point to attach decoration.


Field Summary
static Anchor BOTTOM_LEFT
          Convenience anchor representing a point at the bottom left hand corner.
static Anchor BOTTOM_RIGHT
          Convenience anchor representing a point at the bottom right hand corner.
static Anchor CENTER
          Convenience anchor representing a point at the center.
static Anchor TOP_LEFT
          Convenience anchor representing a point at the top left hand corner.
static Anchor TOP_RIGHT
          Convenience anchor representing a point at the top right hand corner.
 
Constructor Summary
Anchor(Anchor anchor)
          Constructor specifying an anchor to copy from.
Anchor(float relativeX, float relativeY)
          Anchor specifying the relative positions on the X axis and Y axis.
Anchor(float relativeX, int offsetX, float relativeY, int offsetY)
          Anchor specifying the relative positions and offsets on the X axis and Y axis.
 
Method Summary
 Point getAnchorPoint(Dimension size)
          Retrieves a point on an object of the specified size.
 Point getAnchorPoint(int width, int height)
          Retrieves a point on an object of the specified size.
 int getOffsetX()
          Gets the offset in pixels on the X axis, relatively to relativeX.
 int getOffsetY()
          Gets the offset in pixels on the Y axis, relatively to relativeY.
 float getRelativeX()
          Gets the relative position in percentage relatively to the origin and length on the X axis.
 float getRelativeY()
          Gets the relative position in percentage relatively to the origin and length on the Y axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOP_LEFT

public static final Anchor TOP_LEFT
Convenience anchor representing a point at the top left hand corner.


TOP_RIGHT

public static final Anchor TOP_RIGHT
Convenience anchor representing a point at the top right hand corner.


BOTTOM_LEFT

public static final Anchor BOTTOM_LEFT
Convenience anchor representing a point at the bottom left hand corner.


BOTTOM_RIGHT

public static final Anchor BOTTOM_RIGHT
Convenience anchor representing a point at the bottom right hand corner.


CENTER

public static final Anchor CENTER
Convenience anchor representing a point at the center.

Constructor Detail

Anchor

public Anchor(Anchor anchor)
Constructor specifying an anchor to copy from.

Parameters:
anchor - Anchor to copy from.

Anchor

public Anchor(float relativeX,
              float relativeY)
Anchor specifying the relative positions on the X axis and Y axis.

Parameters:
relativeX - Relative position on the X axis.
relativeY - Relative position on the Y axis.
See Also:
relativeX, relativeY

Anchor

public Anchor(float relativeX,
              int offsetX,
              float relativeY,
              int offsetY)
Anchor specifying the relative positions and offsets on the X axis and Y axis.

Parameters:
relativeX - Relative position on the X axis.
offsetX - Position offset on the X axis.
relativeY - Relative position on the Y axis.
offsetY - Position offset on the Y axis.
See Also:
relativeX, offsetX, relativeY, offsetY
Method Detail

getRelativeX

public float getRelativeX()
Gets the relative position in percentage relatively to the origin and length on the X axis.


getRelativeY

public float getRelativeY()
Gets the relative position in percentage relatively to the origin and length on the Y axis.


getOffsetX

public int getOffsetX()
Gets the offset in pixels on the X axis, relatively to relativeX.


getOffsetY

public int getOffsetY()
Gets the offset in pixels on the Y axis, relatively to relativeY.


getAnchorPoint

public Point getAnchorPoint(Dimension size)
Retrieves a point on an object of the specified size.

Parameters:
size - Size of the object to get the anchor point for.
Returns:
Anchor point.
See Also:
getAnchorPoint(int, int)

getAnchorPoint

public Point getAnchorPoint(int width,
                            int height)
Retrieves a point on an object of the specified size.

Parameters:
width - Width of the object to get the anchor point for.
height - Height of the object to get the anchor point for.
Returns:
Anchor point.
See Also:
getAnchorPoint(Dimension)


Copyright © 2013. All Rights Reserved.