edu.neu.ccs.gui
Class TextAnchor

java.lang.Object
  extended byedu.neu.ccs.gui.TextAnchor

public class TextAnchor
extends Object

The TextAnchor class defines interfaces that specify how to compute the location and bounds of a String that will be displayed using a given Font in conjunction with a given anchor position.

The TextAnchor class also defines static objects that implement the interfaces it defines.

The TextAnchor class cannot be instantiated.

In 2.4.0, this class was updated to be consistent with refinements to the Paintable interface.

Since:
2.3
Version:
2.4.0

Nested Class Summary
static interface TextAnchor.Locator
          The Locator interface defines the methods needed to compute the coordinates, bounds, and center of a String displayed in a given Font using the given anchor positions and this strategy.
static interface TextAnchor.XLocator
          The XLocator interface defines the methods needed to compute the x-coordinate of the left, right, and center of a given String displayed in a given Font using the given anchorX position and this strategy.
static interface TextAnchor.YLocator
          The YLocator interface defines the methods needed to compute the y-coordinate of the base line, ascent line, descent line, and leading line of a given String displayed in a given Font using the given anchorY position and this strategy.
 
Field Summary
static TextAnchor.YLocator ASCENTLINE
          The YLocator object that corresponds to an anchor on the ascent line of the displayed string.
static TextAnchor.YLocator BASELINE
          The YLocator object that corresponds to an anchor on the base line of the displayed string.
static TextAnchor.XLocator CENTER
          The XLocator object that corresponds to an anchor at the horizontal center of the displayed string.
static TextAnchor.Locator CENTER_ASCENTLINE
          The Locator that combines CENTER and ASCENTLINE.
static TextAnchor.Locator CENTER_BASELINE
          The Locator that combines CENTER and BASELINE.
static TextAnchor.Locator CENTER_DESCENTLINE
          The Locator that combines CENTER and DESCENTLINE.
static TextAnchor.Locator CENTER_LEADINGLINE
          The Locator that combines CENTER and LEADINGLINE.
static TextAnchor.YLocator DESCENTLINE
          The YLocator object that corresponds to an anchor on the descent line of the displayed string.
static TextAnchor.YLocator LEADINGLINE
          The YLocator object that corresponds to an anchor on the leading line of the displayed string.
static TextAnchor.XLocator LEFT
          The XLocator object that corresponds to an anchor at the left edge of the displayed string.
static TextAnchor.Locator LEFT_ASCENTLINE
          The Locator that combines LEFT and ASCENTLINE.
static TextAnchor.Locator LEFT_BASELINE
          The Locator that combines LEFT and BASELINE.
static TextAnchor.Locator LEFT_DESCENTLINE
          The Locator that combines LEFT and DESCENTLINE.
static TextAnchor.Locator LEFT_LEADINGLINE
          The Locator that combines LEFT and LEADING.
static TextAnchor.XLocator RIGHT
          The XLocator object that corresponds to an anchor at the right edge of the displayed string.
static TextAnchor.Locator RIGHT_ASCENTLINE
          The Locator that combines RIGHT and ASCENTLINE.
static TextAnchor.Locator RIGHT_BASELINE
          The Locator that combines RIGHT and BASELINE.
static TextAnchor.Locator RIGHT_DESCENTLINE
          The Locator that combines RIGHT and DESCENTLINE.
static TextAnchor.Locator RIGHT_LEADINGLINE
          The Locator that combines RIGHT and LEADINGLINE.
(package private) static FontRenderContext standardFRC
          The standard font render context defined using the identity transform, anti-aliasing on, and fractional-metrics off.
 
Constructor Summary
private TextAnchor()
          Private constructor to prevent instantiation.
 
Method Summary
static TextAnchor.Locator makeLocator(TextAnchor.XLocator xlocator, TextAnchor.YLocator ylocator)
          Returns a Locator object constructed using the given XLocator and YLocator objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

standardFRC

static final FontRenderContext standardFRC
The standard font render context defined using the identity transform, anti-aliasing on, and fractional-metrics off.


LEFT

public static final TextAnchor.XLocator LEFT
The XLocator object that corresponds to an anchor at the left edge of the displayed string.


RIGHT

public static final TextAnchor.XLocator RIGHT
The XLocator object that corresponds to an anchor at the right edge of the displayed string.


CENTER

public static final TextAnchor.XLocator CENTER
The XLocator object that corresponds to an anchor at the horizontal center of the displayed string.


BASELINE

public static final TextAnchor.YLocator BASELINE
The YLocator object that corresponds to an anchor on the base line of the displayed string.


ASCENTLINE

public static final TextAnchor.YLocator ASCENTLINE
The YLocator object that corresponds to an anchor on the ascent line of the displayed string.


DESCENTLINE

public static final TextAnchor.YLocator DESCENTLINE
The YLocator object that corresponds to an anchor on the descent line of the displayed string.


LEADINGLINE

public static final TextAnchor.YLocator LEADINGLINE
The YLocator object that corresponds to an anchor on the leading line of the displayed string.


LEFT_BASELINE

public static final TextAnchor.Locator LEFT_BASELINE
The Locator that combines LEFT and BASELINE.


RIGHT_BASELINE

public static final TextAnchor.Locator RIGHT_BASELINE
The Locator that combines RIGHT and BASELINE.


CENTER_BASELINE

public static final TextAnchor.Locator CENTER_BASELINE
The Locator that combines CENTER and BASELINE.


LEFT_ASCENTLINE

public static final TextAnchor.Locator LEFT_ASCENTLINE
The Locator that combines LEFT and ASCENTLINE.


RIGHT_ASCENTLINE

public static final TextAnchor.Locator RIGHT_ASCENTLINE
The Locator that combines RIGHT and ASCENTLINE.


CENTER_ASCENTLINE

public static final TextAnchor.Locator CENTER_ASCENTLINE
The Locator that combines CENTER and ASCENTLINE.


LEFT_DESCENTLINE

public static final TextAnchor.Locator LEFT_DESCENTLINE
The Locator that combines LEFT and DESCENTLINE.


RIGHT_DESCENTLINE

public static final TextAnchor.Locator RIGHT_DESCENTLINE
The Locator that combines RIGHT and DESCENTLINE.


CENTER_DESCENTLINE

public static final TextAnchor.Locator CENTER_DESCENTLINE
The Locator that combines CENTER and DESCENTLINE.


LEFT_LEADINGLINE

public static final TextAnchor.Locator LEFT_LEADINGLINE
The Locator that combines LEFT and LEADING.


RIGHT_LEADINGLINE

public static final TextAnchor.Locator RIGHT_LEADINGLINE
The Locator that combines RIGHT and LEADINGLINE.


CENTER_LEADINGLINE

public static final TextAnchor.Locator CENTER_LEADINGLINE
The Locator that combines CENTER and LEADINGLINE.

Constructor Detail

TextAnchor

private TextAnchor()
Private constructor to prevent instantiation.

Method Detail

makeLocator

public static TextAnchor.Locator makeLocator(TextAnchor.XLocator xlocator,
                                             TextAnchor.YLocator ylocator)
Returns a Locator object constructed using the given XLocator and YLocator objects.

Parameters:
xlocator - the XLocator object
ylocator - the YLocator object
Returns:
the constructed Locator object