public final class ShapeGraphicAttribute extends GraphicAttribute
| Modifier and Type | Field and Description |
|---|---|
static boolean |
FILL
True if the shape should be filled.
|
static boolean |
STROKE
True if the shape should be stroked with a 1-pixel wide stroke.
|
BOTTOM_ALIGNMENT, CENTER_BASELINE, HANGING_BASELINE, ROMAN_BASELINE, TOP_ALIGNMENT| Constructor and Description |
|---|
ShapeGraphicAttribute(Shape shape,
int alignment,
boolean stroke)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(Graphics2D graphics,
float x,
float y)
Draws the graphic at the given location.
|
boolean |
equals(Object obj)
Compares this ShapeGraphicAttribute to obj.
|
boolean |
equals(ShapeGraphicAttribute rhs)
Compares this ShapeGraphicAttribute to rhs.
|
float |
getAdvance()
Gets the distance from the origin of its Shape to the right side of the
bounds of its Shape.
|
float |
getAscent()
Gets the positive distance from the origin of its Shape to the top of
bounds.
|
Rectangle2D |
getBounds()
Returns a Rectangle2D that encloses all of the bits drawn by this shape.
|
float |
getDescent()
Gets the distance from the origin of its Shape to the bottom of the bounds.
|
int |
hashCode()
Gets the hash code.
|
getAlignment, getJustificationInfopublic static final boolean FILL
public static final boolean STROKE
public ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke)
shape - - the Shape to render. The Shape is rendered with its origin.alignment - - the alignmentstroke - - true if the Shape should be stroked; false if the Shape
should be filled.public void draw(Graphics2D graphics, float x, float y)
draw in class GraphicAttributegraphics - - the graphics to use.x - - the x location to draw at.y - - the y location to draw at.public boolean equals(Object obj)
equals in class Objectobj - - the object to compare.Object.hashCode()public boolean equals(ShapeGraphicAttribute rhs)
rhs - - the ShapeGraphicAttribute to compare.public float getAdvance()
getAdvance in class GraphicAttributepublic float getAscent()
getAscent in class GraphicAttributepublic float getDescent()
getDescent in class GraphicAttributepublic Rectangle2D getBounds()
getBounds in class GraphicAttributepublic int hashCode()
hashCode in class ObjectObject.equals(Object),
System.identityHashCode(Object)