org.zaval.misc
Class Alignment

java.lang.Object
  |
  +--org.zaval.misc.Alignment

public class Alignment
extends java.lang.Object

This class provides set of useful methods to calculate metrical characteristics for a rectangular area that has vertical or horizontal alignments. The alignments types are shown with the table below (it is supposed that the table is the rectangular area), where the horizontal alignment is denoted with ax, and vertical - ay:

ax = Alignment.LEFT
ay = Alignment.TOP
ax = Alignment.CENTER
ay = Alignment.TOP
ax = Alignment.RIGHT
ay = Alignment.TOP
ax = Alignment.LEFT
ay = Alignment.CENTER
ax = Alignment.CENTER
ay = Alignment.CENTER
ax = Alignment.RIGHT
ay = Alignment.CENTER
ax = Alignment.LEFT
ay = Alignment.BOTTOM
ax = Alignment.CENTER
ay = Alignment.BOTTOM
ax = Alignment.RIGHT
ay = Alignment.BOTTOM


Field Summary
static int BOTTOM
          The bottom vertical alignment type.
static int CENTER
          The center horizontal or vertical alignment type.
static int LEFT
          The left horizontal alignment type.
static int NONE
          The none horizontal or vertical alignment type.
static int RIGHT
          The right horizontal alignment type.
static int TOP
          The top vertical alignment type.
 
Constructor Summary
Alignment()
           
 
Method Summary
static java.awt.Point getLocation(java.awt.Dimension alignObj, int alignX, int alignY, int aw, int ah)
          Calculates and returns location of the specified rectangular area that is adjusted inside the given rectangular area with the specified horizontal and vertical alignments .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
The left horizontal alignment type.

RIGHT

public static final int RIGHT
The right horizontal alignment type.

TOP

public static final int TOP
The top vertical alignment type.

BOTTOM

public static final int BOTTOM
The bottom vertical alignment type.

CENTER

public static final int CENTER
The center horizontal or vertical alignment type.

NONE

public static final int NONE
The none horizontal or vertical alignment type.
Constructor Detail

Alignment

public Alignment()
Method Detail

getLocation

public static java.awt.Point getLocation(java.awt.Dimension alignObj,
                                         int alignX,
                                         int alignY,
                                         int aw,
                                         int ah)
Calculates and returns location of the specified rectangular area that is adjusted inside the given rectangular area with the specified horizontal and vertical alignments .
Parameters:
alignObj - the specified rectangular area to be adjusted.
ax - the specified horizontal alignment.
ay - the specified vertical alignment.
aw - the specified align area width.
ah - the specified align area height.
Returns:
a location. The method throws IllegalArgumentException if the horizontal or vertical alignment is undefined.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org