|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.xdoc.fig.Anchor
public abstract class Anchor
Utility for positioning things in the graphics context.
Field Summary | |
---|---|
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 Summary | |
---|---|
Anchor()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public Anchor()
Method Detail |
---|
public abstract Point getPoint(Rectangle box)
box
- rectangle
box
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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |