Java Platform 1.2
Beta 4

Class java.awt.font.ImageGraphicAttribute

java.lang.Object
  |
  +--java.awt.font.GraphicAttribute
        |
        +--java.awt.font.ImageGraphicAttribute

public final class ImageGraphicAttribute
extends GraphicAttribute
This is an implementation of GraphicAttribute which draws Images in a TextLayout.

See Also:
GraphicAttribute

Fields inherited from class java.awt.font.GraphicAttribute
BOTTOM_ALIGNMENT , CENTER_BASELINE , HANGING_BASELINE , ROMAN_BASELINE , TOP_ALIGNMENT
 
Constructor Summary
ImageGraphicAttribute(Image image, int alignment, float originX, float originY)
          Constuct an ImageGraphicAttribute from the specified Image.
ImageGraphicAttribute(Image image, int alignment)
          Constuct an ImageGraphicAttribute from the specified Image.
 
Method Summary
 void draw(Graphics2D graphics, float x, float y)
          Draw the graphic at the given location.
 boolean equals(ImageGraphicAttribute rhs)
          Compares this object to the specified ImageGraphicAttribute.
 boolean equals(Object rhs)
          Compares this object to the specified object.
 float getAdvance()
          Return the advance of this graphic.
 float getAscent()
          Return the ascent of this graphic.
 Rectangle2D getBounds()
          Returns a rectangle which encloses all of the bits drawn by this graphic (relative to the drawing position, of course).
 float getDescent()
          Return the descent of this graphic.
 int hashCode()
          Returns a hashcode for this ImageGraphicAttribute.
 
Methods inherited from class java.awt.font.GraphicAttribute
getAlignment , getJustificationInfo
 
Methods inherited from class java.lang.Object
clone , finalize , getClass , notify , notifyAll , toString , wait , wait , wait
 

Constructor Detail

ImageGraphicAttribute

public ImageGraphicAttribute(Image image,
                             int alignment)
Constuct an ImageGraphicAttribute from the specified Image. The origin is at (0, 0).
Parameters:
image - the image drawn by this ImageGraphicAttribute. This object keeps a reference to image.
alignment - the alignment (one of the alignments from GraphicAttribute).

ImageGraphicAttribute

public ImageGraphicAttribute(Image image,
                             int alignment,
                             float originX,
                             float originY)
Constuct an ImageGraphicAttribute from the specified Image. The point (originX, originY) in the Image will appear at the ImageGraphicAttribute's origin within the text.
Parameters:
image - the image drawn by this ImageGraphicAttribute. This object keeps a reference to image.
alignment - the alignment (one of the alignments from GraphicAttribute).
originX - the point within the Image which will appear at the ImageGraphicAttribute's origin in the text line.
originY - the point within the Image which will appear at the ImageGraphicAttribute's origin in the text line.
Method Detail

getAscent

public float getAscent()
Return the ascent of this graphic. The ascent of an ImageGraphicAttribute is the distance from the top of the image to the specified origin.
Returns:
the ascent of this graphic
Overrides:
getAscent in class GraphicAttribute

getDescent

public float getDescent()
Return the descent of this graphic. The descent of an ImageGraphicAttribute is the distance from the specified origin to the bottom of the image.
Returns:
the descent of this graphic
Overrides:
getDescent in class GraphicAttribute

getAdvance

public float getAdvance()
Return the advance of this graphic. The advance of an ImageGraphicAttribute is the distance from the specified origin to the right edge of the image.
Returns:
the advance of this graphic
Overrides:
getAdvance in class GraphicAttribute

getBounds

public Rectangle2D getBounds()
Returns a rectangle which encloses all of the bits drawn by this graphic (relative to the drawing position, of course). A graphic may draw beyond its origin, ascent, descent, or advance; but if it does, this method's implementation should indicate where the graphic draws.
Returns:
a Rectangle2D which encloses all of the bits drawn by this graphic.
Overrides:
getBounds in class GraphicAttribute

draw

public void draw(Graphics2D graphics,
                 float x,
                 float y)
Draw the graphic at the given location.
Parameters:
graphics - the Graphics2D into which to draw the graphic
x - the x-coordinate (in user space) where the graphic is drawn
y - the y-coordinate (in user space) where the graphic is drawn
Overrides:
draw in class GraphicAttribute

hashCode

public int hashCode()
Returns a hashcode for this ImageGraphicAttribute.
Returns:
a hash code value for this object
Overrides:
hashCode in class Object

equals

public boolean equals(Object rhs)
Compares this object to the specified object.
Parameters:
rhs - the object to compare for equality
Returns:
true if this equals rhs
Overrides:
equals in class Object

equals

public boolean equals(ImageGraphicAttribute rhs)
Compares this object to the specified ImageGraphicAttribute.
Parameters:
rhs - the ImageGraphicAttribute to compare for equality
Returns:
true if this equals rhs

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.