java.awt.font
Class ShapeGraphicAttribute

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.font.GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute 
      extended by java.awt.font.ShapeGraphicAttribute

public final class ShapeGraphicAttribute
extends GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute

The ShapeGraphicAttribute class is an implementation of GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute that draws shapes in a TextLayout sample code for java.awt.font.TextLayout definition code for java.awt.font.TextLayout .

See Also:
GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute

Field Summary
static boolean FILL sample code for java.awt.font.ShapeGraphicAttribute.FILL definition code for java.awt.font.ShapeGraphicAttribute.FILL
          A key indicating the shape should be filled.
static boolean STROKE sample code for java.awt.font.ShapeGraphicAttribute.STROKE definition code for java.awt.font.ShapeGraphicAttribute.STROKE
          A key indicating the shape should be stroked with a 1-pixel wide stroke.
 
Fields inherited from class java.awt.font.GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute
BOTTOM_ALIGNMENT sample code for java.awt.font.GraphicAttribute.BOTTOM_ALIGNMENT definition code for java.awt.font.GraphicAttribute.BOTTOM_ALIGNMENT , CENTER_BASELINE sample code for java.awt.font.GraphicAttribute.CENTER_BASELINE definition code for java.awt.font.GraphicAttribute.CENTER_BASELINE , HANGING_BASELINE sample code for java.awt.font.GraphicAttribute.HANGING_BASELINE definition code for java.awt.font.GraphicAttribute.HANGING_BASELINE , ROMAN_BASELINE sample code for java.awt.font.GraphicAttribute.ROMAN_BASELINE definition code for java.awt.font.GraphicAttribute.ROMAN_BASELINE , TOP_ALIGNMENT sample code for java.awt.font.GraphicAttribute.TOP_ALIGNMENT definition code for java.awt.font.GraphicAttribute.TOP_ALIGNMENT
 
Constructor Summary
ShapeGraphicAttribute sample code for java.awt.font.ShapeGraphicAttribute.ShapeGraphicAttribute(java.awt.Shape, int, boolean) definition code for java.awt.font.ShapeGraphicAttribute.ShapeGraphicAttribute(java.awt.Shape, int, boolean) (Shape sample code for java.awt.Shape definition code for java.awt.Shape  shape, int alignment, boolean stroke)
          Constructs a ShapeGraphicAttribute for the specified Shape sample code for java.awt.Shape definition code for java.awt.Shape .
 
Method Summary
 void draw sample code for java.awt.font.ShapeGraphicAttribute.draw(java.awt.Graphics2D, float, float) definition code for java.awt.font.ShapeGraphicAttribute.draw(java.awt.Graphics2D, float, float) (Graphics2D sample code for java.awt.Graphics2D definition code for java.awt.Graphics2D  graphics, float x, float y)
          Draws the graphic at the given location.
 boolean equals sample code for java.awt.font.ShapeGraphicAttribute.equals(java.lang.Object) definition code for java.awt.font.ShapeGraphicAttribute.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  rhs)
          Compares this ShapeGraphicAttribute to the specified Object.
 boolean equals sample code for java.awt.font.ShapeGraphicAttribute.equals(java.awt.font.ShapeGraphicAttribute) definition code for java.awt.font.ShapeGraphicAttribute.equals(java.awt.font.ShapeGraphicAttribute) (ShapeGraphicAttribute sample code for java.awt.font.ShapeGraphicAttribute definition code for java.awt.font.ShapeGraphicAttribute  rhs)
          Compares this ShapeGraphicAttribute to the specified ShapeGraphicAttribute.
 float getAdvance sample code for java.awt.font.ShapeGraphicAttribute.getAdvance() definition code for java.awt.font.ShapeGraphicAttribute.getAdvance() ()
          Returns the advance of this ShapeGraphicAttribute.
 float getAscent sample code for java.awt.font.ShapeGraphicAttribute.getAscent() definition code for java.awt.font.ShapeGraphicAttribute.getAscent() ()
          Returns the ascent of this ShapeGraphicAttribute.
 Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D getBounds sample code for java.awt.font.ShapeGraphicAttribute.getBounds() definition code for java.awt.font.ShapeGraphicAttribute.getBounds() ()
          Returns a Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D that encloses all of the bits drawn by this ShapeGraphicAttribute relative to the rendering position.
 float getDescent sample code for java.awt.font.ShapeGraphicAttribute.getDescent() definition code for java.awt.font.ShapeGraphicAttribute.getDescent() ()
          Returns the descent of this ShapeGraphicAttribute.
 int hashCode sample code for java.awt.font.ShapeGraphicAttribute.hashCode() definition code for java.awt.font.ShapeGraphicAttribute.hashCode() ()
          Returns a hashcode for this ShapeGraphicAttribute.
 
Methods inherited from class java.awt.font.GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute
getAlignment sample code for java.awt.font.GraphicAttribute.getAlignment() definition code for java.awt.font.GraphicAttribute.getAlignment() , getJustificationInfo sample code for java.awt.font.GraphicAttribute.getJustificationInfo() definition code for java.awt.font.GraphicAttribute.getJustificationInfo()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

STROKE sample code for java.awt.font.ShapeGraphicAttribute.STROKE

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

See Also:
Constant Field Values

FILL sample code for java.awt.font.ShapeGraphicAttribute.FILL

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

See Also:
Constant Field Values
Constructor Detail

ShapeGraphicAttribute sample code for java.awt.font.ShapeGraphicAttribute(java.awt.Shape, int, boolean) definition code for java.awt.font.ShapeGraphicAttribute(java.awt.Shape, int, boolean)

public ShapeGraphicAttribute(Shape sample code for java.awt.Shape definition code for java.awt.Shape  shape,
                             int alignment,
                             boolean stroke)
Constructs a ShapeGraphicAttribute for the specified Shape sample code for java.awt.Shape definition code for java.awt.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

getAscent sample code for java.awt.font.ShapeGraphicAttribute.getAscent() definition code for java.awt.font.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.

Specified by:
getAscent sample code for java.awt.font.GraphicAttribute.getAscent() definition code for java.awt.font.GraphicAttribute.getAscent() in class GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute
Returns:
the ascent of this ShapeGraphicAttribute.
See Also:
GraphicAttribute.getBounds() sample code for java.awt.font.GraphicAttribute.getBounds() definition code for java.awt.font.GraphicAttribute.getBounds()

getDescent sample code for java.awt.font.ShapeGraphicAttribute.getDescent() definition code for java.awt.font.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.

Specified by:
getDescent sample code for java.awt.font.GraphicAttribute.getDescent() definition code for java.awt.font.GraphicAttribute.getDescent() in class GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute
Returns:
the descent of this ShapeGraphicAttribute.
See Also:
GraphicAttribute.getBounds() sample code for java.awt.font.GraphicAttribute.getBounds() definition code for java.awt.font.GraphicAttribute.getBounds()

getAdvance sample code for java.awt.font.ShapeGraphicAttribute.getAdvance() definition code for java.awt.font.ShapeGraphicAttribute.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.

Specified by:
getAdvance sample code for java.awt.font.GraphicAttribute.getAdvance() definition code for java.awt.font.GraphicAttribute.getAdvance() in class GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute
Returns:
the advance of this ShapeGraphicAttribute.
See Also:
GraphicAttribute.getBounds() sample code for java.awt.font.GraphicAttribute.getBounds() definition code for java.awt.font.GraphicAttribute.getBounds()

draw sample code for java.awt.font.ShapeGraphicAttribute.draw(java.awt.Graphics2D, float, float) definition code for java.awt.font.ShapeGraphicAttribute.draw(java.awt.Graphics2D, float, float)

public void draw(Graphics2D sample code for java.awt.Graphics2D definition code for java.awt.Graphics2D  graphics,
                 float x,
                 float y)
Draws the graphic at the given location. The Shape is drawn with its origin at (x, y).

Specified by:
draw sample code for java.awt.font.GraphicAttribute.draw(java.awt.Graphics2D, float, float) definition code for java.awt.font.GraphicAttribute.draw(java.awt.Graphics2D, float, float) in class GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute
Parameters:
graphics - the Graphics2D sample code for java.awt.Graphics2D definition code for java.awt.Graphics2D into which to draw the graphic
x, y - the user space coordinates where the graphic is drawn

getBounds sample code for java.awt.font.ShapeGraphicAttribute.getBounds() definition code for java.awt.font.ShapeGraphicAttribute.getBounds()

public Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.Rectangle2D  getBounds()
Returns a Rectangle2D sample code for java.awt.geom.Rectangle2D definition code for java.awt.geom.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 sample code for java.awt.font.GraphicAttribute.getBounds() definition code for java.awt.font.GraphicAttribute.getBounds() in class GraphicAttribute sample code for java.awt.font.GraphicAttribute definition code for java.awt.font.GraphicAttribute
Returns:
a Rectangle2D that encloses all of the bits rendered by this ShapeGraphicAttribute.

hashCode sample code for java.awt.font.ShapeGraphicAttribute.hashCode() definition code for java.awt.font.ShapeGraphicAttribute.hashCode()

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

Overrides:
hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a hash code value for this ShapeGraphicAttribute.
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

equals sample code for java.awt.font.ShapeGraphicAttribute.equals(java.lang.Object) definition code for java.awt.font.ShapeGraphicAttribute.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  rhs)
Compares this ShapeGraphicAttribute to the specified Object.

Overrides:
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) in class Object sample code for java.lang.Object definition code for java.lang.Object
Parameters:
rhs - the Object to compare for equality
Returns:
true if this ShapeGraphicAttribute equals rhs; false otherwise.
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

equals sample code for java.awt.font.ShapeGraphicAttribute.equals(java.awt.font.ShapeGraphicAttribute) definition code for java.awt.font.ShapeGraphicAttribute.equals(java.awt.font.ShapeGraphicAttribute)

public boolean equals(ShapeGraphicAttribute sample code for java.awt.font.ShapeGraphicAttribute definition code for java.awt.font.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.