This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.awt.font
class ShapeGraphicAttribute

java.lang.Object extended by java.awt.font.GraphicAttribute extended by java.awt.font.ShapeGraphicAttribute

public final class ShapeGraphicAttribute
extends GraphicAttribute

The ShapeGraphicAttribute class is an implementation of {@link GraphicAttribute} that draws shapes in a {@link TextLayout}.


Field Summary
static boolean FILL
          A key indicating the shape should be filled.
static boolean STROKE
          A key indicating the shape should be stroked with a 1-pixel wide stroke.
 
Fields inherited from class java.awt.font.GraphicAttribute
BOTTOM_ALIGNMENT, CENTER_BASELINE, HANGING_BASELINE, ROMAN_BASELINE, TOP_ALIGNMENT
 
Constructor Summary
ShapeGraphicAttribute(Shape shape, int alignment, boolean stroke)

          Constructs a ShapeGraphicAttribute for the specified java.awt.Shape.
 
Method Summary
 void
draw(Graphics2D graphics, float x, float y)

          Renders this GraphicAttribute at the specified location.
 boolean

          Compares this ShapeGraphicAttribute to the specified Object.
 boolean

          Compares this ShapeGraphicAttribute to the specified ShapeGraphicAttribute.
 float

          Returns the advance of this ShapeGraphicAttribute.
 float

          Returns the ascent of this ShapeGraphicAttribute.
 Rectangle2D

          Returns a java.awt.geom.Rectangle2D that encloses all of the bits drawn by this ShapeGraphicAttribute relative to the rendering position.
 float

          Returns the descent of this ShapeGraphicAttribute.
 Shape

          Return a java.awt.Shape that represents the region that this ShapeGraphicAttribute renders.
 int

          Returns a hashcode for this ShapeGraphicAttribute.
 
Methods inherited from class java.awt.font.GraphicAttribute
draw, getAdvance, getAlignment, getAscent, getBounds, getDescent, getJustificationInfo, getOutline
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILL

public static final boolean FILL
A key indicating the shape should be filled.

STROKE

public static final boolean STROKE
A key indicating the shape should be stroked with a 1-pixel wide stroke.
Constructor Detail

ShapeGraphicAttribute

public ShapeGraphicAttribute(Shape shape,
                             int alignment,
                             boolean stroke)
Constructs a ShapeGraphicAttribute for the specified {@link Shape}.

Parameters:
shape - the Shape to render. The Shape is rendered with its origin at the origin of this ShapeGraphicAttribute in the host TextLayout. This object maintains a reference to shape.
alignment - one of the alignments from this ShapeGraphicAttribute.
stroke - true if the Shape should be stroked; false if the Shape should be filled.
Method Detail

draw

public void draw(Graphics2D graphics,
                 float x,
                 float y)
{@inheritDoc}

Overrides:
draw in class GraphicAttribute
Parameters:
graphics
x
y

equals

public boolean equals(Object rhs)
Compares this ShapeGraphicAttribute to the specified Object.

Overrides:
equals in class Object
Parameters:
rhs - the Object to compare for equality
Returns:
true if this ShapeGraphicAttribute equals rhs; false otherwise.

equals

public boolean equals(ShapeGraphicAttribute rhs)
Compares this ShapeGraphicAttribute to the specified ShapeGraphicAttribute.

Parameters:
rhs - the ShapeGraphicAttribute to compare for equality
Returns:
true if this ShapeGraphicAttribute equals rhs; false otherwise.

getAdvance

public float getAdvance()
Returns the advance of this ShapeGraphicAttribute. The advance of a ShapeGraphicAttribute is the distance from the origin of its Shape to the right side of the bounds of its Shape.

Overrides:
getAdvance in class GraphicAttribute
Returns:
the advance of this ShapeGraphicAttribute.

getAscent

public float getAscent()
Returns the ascent of this ShapeGraphicAttribute. The ascent of a ShapeGraphicAttribute is the positive distance from the origin of its Shape to the top of bounds of its Shape.

Overrides:
getAscent in class GraphicAttribute
Returns:
the ascent of this ShapeGraphicAttribute.

getBounds

public Rectangle2D getBounds()
Returns a {@link Rectangle2D} that encloses all of the bits drawn by this ShapeGraphicAttribute relative to the rendering position. A graphic can be rendered beyond its origin, ascent, descent, or advance; but if it does, this method's implementation should indicate where the graphic is rendered.

Overrides:
getBounds in class GraphicAttribute
Returns:
a Rectangle2D that encloses all of the bits rendered by this ShapeGraphicAttribute.

getDescent

public float getDescent()
Returns the descent of this ShapeGraphicAttribute. The descent of a ShapeGraphicAttribute is the distance from the origin of its Shape to the bottom of the bounds of its Shape.

Overrides:
getDescent in class GraphicAttribute
Returns:
the descent of this ShapeGraphicAttribute.

getOutline

public Shape getOutline(AffineTransform tx)
Return a {@link java.awt.Shape} that represents the region that this ShapeGraphicAttribute renders. This is used when a {@link TextLayout} is requested to return the outline of the text. The (untransformed) shape must not extend outside the rectangular bounds returned by getBounds.

Overrides:
getOutline in class GraphicAttribute
Parameters:
tx - an optional {@link AffineTransform} to apply to the this ShapeGraphicAttribute. This can be null.
Returns:
the Shape representing this graphic attribute, suitable for stroking or filling.

hashCode

public int hashCode()
Returns a hashcode for this ShapeGraphicAttribute.

Overrides:
hashCode in class Object
Returns:
a hash code value for this ShapeGraphicAttribute.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.