org.jdrawing.graphics
Class DrawString

java.lang.Object
  extended byorg.jdrawing.graphics.GraphicsOperation
      extended byorg.jdrawing.graphics.DrawString
All Implemented Interfaces:
DrawingElement

public class DrawString
extends GraphicsOperation

Graphics element which corresponds to Graphics.drawString(String, int, int)


Constructor Summary
DrawString(java.text.AttributedCharacterIterator iterator, float x, float y)
          Returns DrawString for the text of specified iterator at specified location.
DrawString(java.text.AttributedCharacterIterator iterator, float x, float y, Style style)
          Returns DrawString for the text of specified iterator at specified location with specified style.
DrawString(java.lang.String text, float x, float y)
          Returns DrawString for specified text at specified location.
DrawString(java.lang.String text, float x, float y, Style style)
          Returns DrawString for specified text at specified location with specified style.
 
Method Summary
 java.text.AttributedCharacterIterator getIterator()
          Returns the iterator whose text is to be rendered or null if the text was specified explicitly.
 java.awt.Shape getShapeOfOperation()
          Returns shape of the area updated by this operation.
 java.lang.String getText()
          Returns the text to be drawn or null is iterator was specified.
 float getX()
          Returns the X coordinate of the text.
 float getY()
          Returns the Y coordinate of the text.
 void paintOperation(java.awt.Graphics2D graphics)
          Performs drawing operation.
 void setIterator(java.text.AttributedCharacterIterator iterator)
          Sets the AttributedCharacterIterator whose text is to be rendered.
 void setText(java.lang.String text)
          Sets the text to be drawn.
 void setX(float x)
          Sets the X coordinate of the text.
 void setY(float y)
          Sets the Y coordinate of the text.
 
Methods inherited from class org.jdrawing.graphics.GraphicsOperation
contains, getBounds, getBounds2D, getPosition, getStyle, intersects, paint, setPosition, setStyle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawString

public DrawString(java.lang.String text,
                  float x,
                  float y)
Returns DrawString for specified text at specified location.

Parameters:
text - text to be drown
x - the x coordinate of the string
y - the y coordinate of the string

DrawString

public DrawString(java.lang.String text,
                  float x,
                  float y,
                  Style style)
Returns DrawString for specified text at specified location with specified style.

Parameters:
text - text to be drown
x - the x coordinate of the string
y - the y coordinate of the string

DrawString

public DrawString(java.text.AttributedCharacterIterator iterator,
                  float x,
                  float y)
Returns DrawString for the text of specified iterator at specified location.

Parameters:
iterator - the iterator whose text is to be rendered
x - the x coordinate of the string
y - the y coordinate of the string

DrawString

public DrawString(java.text.AttributedCharacterIterator iterator,
                  float x,
                  float y,
                  Style style)
Returns DrawString for the text of specified iterator at specified location with specified style.

Parameters:
iterator - the iterator whose text is to be rendered
x - the x coordinate of the string
y - the y coordinate of the string
Method Detail

setText

public void setText(java.lang.String text)
Sets the text to be drawn.

Parameters:
text - text to be drown

getText

public java.lang.String getText()
Returns the text to be drawn or null is iterator was specified.

Returns:
text to be drawn or null

setIterator

public void setIterator(java.text.AttributedCharacterIterator iterator)
Sets the AttributedCharacterIterator whose text is to be rendered.

Parameters:
iterator - the iterator whose text is to be rendered

getIterator

public java.text.AttributedCharacterIterator getIterator()
Returns the iterator whose text is to be rendered or null if the text was specified explicitly. This method returns the copy of iterator used.

Returns:
the iterator whose text is to be rendered or null

setX

public void setX(float x)
Sets the X coordinate of the text.

Parameters:
x - the x coordinate

getX

public float getX()
Returns the X coordinate of the text.

Returns:
the x coordinate

setY

public void setY(float y)
Sets the Y coordinate of the text.

Parameters:
y - the y coordinate

getY

public float getY()
Returns the Y coordinate of the text.

Returns:
the y coordinate

paintOperation

public void paintOperation(java.awt.Graphics2D graphics)
Performs drawing operation. This implementation invokes graphics.drawString ().

Specified by:
paintOperation in class GraphicsOperation
Parameters:
graphics - graphics context to use for painting

getShapeOfOperation

public java.awt.Shape getShapeOfOperation()
Returns shape of the area updated by this operation.

Specified by:
getShapeOfOperation in class GraphicsOperation
Returns:
the shape of updated area