public abstract class XYShape
extends java.lang.Object
This object acts as a factory for Glyphs. These glyphs are lazily cached per instance of this class for small values of the X and Y coordinates (since there aren't very many of them, and they are probably used frequently); for larger values, the glyphs are created on demand.
Modifier and Type | Field and Description |
---|---|
static Glyph |
POINT
Glyph that paints a single pixel at the origin.
|
Modifier | Constructor and Description |
---|---|
protected |
XYShape(java.lang.String name)
Constructs a shape with a default cache limit.
|
protected |
XYShape(java.lang.String name,
int maxCacheRadius)
Constructs a shape with a specified cache limit.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Glyph |
createGlyph(short sx,
short sy)
Constructs a new glyph with given coordinates.
|
static javax.swing.Icon |
createIcon(XYShape shape,
int width,
int height,
boolean useComponentColor)
Returns an icon displaying a given shape.
|
Glyph |
getGlyph(short sx,
short sy)
Obtains a glyph characterised by a given pair of values.
|
java.lang.String |
getName()
Returns the name of this shape.
|
boolean |
isCached(short sx,
short sy)
Indicates whether a glyph of a given size will be cached.
|
java.lang.String |
toString() |
public static Glyph POINT
protected XYShape(java.lang.String name, int maxCacheRadius)
name
- shape namemaxCacheRadius
- glyphs are cached if both input values
have an absolute value lower than or equal
to this limitprotected XYShape(java.lang.String name)
name
- shape namepublic java.lang.String getName()
public boolean isCached(short sx, short sy)
sx
- X radiussy
- Y radiuspublic Glyph getGlyph(short sx, short sy)
sx
- X valuesy
- Y valueprotected abstract Glyph createGlyph(short sx, short sy)
sx
- X valuesy
- Y valuepublic java.lang.String toString()
toString
in class java.lang.Object
public static javax.swing.Icon createIcon(XYShape shape, int width, int height, boolean useComponentColor)
shape
- shapewidth
- icon widthheight
- icon heightuseComponentColor
- if true, the glyph will be painted in
the component's foreground colourCopyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.