public abstract class Anchor extends Object
Modifier and Type | Field and Description |
---|---|
static Color |
BG
Background colour.
|
static Anchor |
CENTRE |
static Anchor |
EAST |
static Anchor |
NORTH |
static Anchor |
NORTH_EAST |
static Anchor |
NORTH_WEST |
static Anchor |
SOUTH |
static Anchor |
SOUTH_EAST |
static Anchor |
SOUTH_WEST |
static Anchor |
WEST |
Constructor and Description |
---|
Anchor() |
Modifier and Type | Method and Description |
---|---|
static Anchor |
createFractionAnchor(float xfrac,
float yfrac)
Returns an anchor defined by fractional amounts along each edge of a box.
|
Rectangle |
drawString(Graphics g,
String text,
int x,
int y,
boolean clearBg)
Positions a string relative to the given reference point,
optionally clearing the background first.
|
abstract Point |
getPoint(Rectangle box)
Returns the position of this anchor point in a given rectangle.
|
public static final Color BG
public static final Anchor CENTRE
public static final Anchor WEST
public static final Anchor EAST
public static final Anchor NORTH
public static final Anchor SOUTH
public static final Anchor NORTH_WEST
public static final Anchor SOUTH_WEST
public static final Anchor NORTH_EAST
public static final Anchor SOUTH_EAST
public abstract Point getPoint(Rectangle box)
box
- rectanglebox
public Rectangle drawString(Graphics g, String text, int x, int y, boolean clearBg)
g
- graphics contexttext
- string to drawx
- reference point X coordinatey
- reference point Y coordinateclearBg
- true iff you want to clear the background for
the text to the background colour (white) before
painting the textpublic static Anchor createFractionAnchor(float xfrac, float yfrac)
xfrac
- left-right amount (0-1)yfrac
- top-bottom amount (0-1)Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.