org.jfree.text

Class TextBox

Implemented Interfaces:
Serializable

public class TextBox
extends java.lang.Object
implements Serializable

A box containing a text block.
Author:
David Gilbert

Constructor Summary

TextBox()
Creates an empty text box.
TextBox(String text)
Creates a text box.
TextBox(TextBlock block)
Creates a new text box.

Method Summary

void
draw(Graphics2D g2, float x, float y, RectangleAnchor anchor)
Draws the text box.
boolean
equals(Object obj)
Tests this object for equality with an arbitrary object.
Paint
getBackgroundPaint()
Returns the background paint.
double
getHeight(Graphics2D g2)
Returns the height of the text box.
RectangleInsets
getInteriorGap()
Returns the interior gap.
Paint
getOutlinePaint()
Returns the outline paint.
Stroke
getOutlineStroke()
Returns the outline stroke.
Paint
getShadowPaint()
Returns the shadow paint.
double
getShadowXOffset()
Returns the x-offset for the shadow effect.
double
getShadowYOffset()
Returns the y-offset for the shadow effect.
TextBlock
getTextBlock()
Returns the text block.
int
hashCode()
Returns a hash code for this object.
void
setBackgroundPaint(Paint paint)
Sets the background paint.
void
setInteriorGap(RectangleInsets gap)
Sets the interior gap.
void
setOutlinePaint(Paint paint)
Sets the outline paint.
void
setOutlineStroke(Stroke stroke)
Sets the outline stroke.
void
setShadowPaint(Paint paint)
Sets the shadow paint.
void
setShadowXOffset(double offset)
Sets the x-offset for the shadow effect.
void
setShadowYOffset(double offset)
Sets the y-offset for the shadow effect.
void
setTextBlock(TextBlock block)
Sets the text block.

Constructor Details

TextBox

public TextBox()
Creates an empty text box.

TextBox

public TextBox(String text)
Creates a text box.
Parameters:
text - the text.

TextBox

public TextBox(TextBlock block)
Creates a new text box.
Parameters:
block - the text block.

Method Details

draw

public void draw(Graphics2D g2,
                 float x,
                 float y,
                 RectangleAnchor anchor)
Draws the text box.
Parameters:
g2 - the graphics device.
x - the x-coordinate.
y - the y-coordinate.
anchor - the anchor point.

equals

public boolean equals(Object obj)
Tests this object for equality with an arbitrary object.
Parameters:
obj - the object to test against (null permitted).
Returns:
A boolean.

getBackgroundPaint

public Paint getBackgroundPaint()
Returns the background paint.
Returns:
The background paint.

getHeight

public double getHeight(Graphics2D g2)
Returns the height of the text box.
Parameters:
g2 - the graphics device.
Returns:
The height (in Java2D units).

getInteriorGap

public RectangleInsets getInteriorGap()
Returns the interior gap.
Returns:
The interior gap.

getOutlinePaint

public Paint getOutlinePaint()
Returns the outline paint.
Returns:
The outline paint.

getOutlineStroke

public Stroke getOutlineStroke()
Returns the outline stroke.
Returns:
The outline stroke.

getShadowPaint

public Paint getShadowPaint()
Returns the shadow paint.
Returns:
The shadow paint.

getShadowXOffset

public double getShadowXOffset()
Returns the x-offset for the shadow effect.
Returns:
The offset.

getShadowYOffset

public double getShadowYOffset()
Returns the y-offset for the shadow effect.
Returns:
The offset.

getTextBlock

public TextBlock getTextBlock()
Returns the text block.
Returns:
The text block.

hashCode

public int hashCode()
Returns a hash code for this object.
Returns:
A hash code.

setBackgroundPaint

public void setBackgroundPaint(Paint paint)
Sets the background paint.
Parameters:
paint - the paint.

setInteriorGap

public void setInteriorGap(RectangleInsets gap)
Sets the interior gap.
Parameters:
gap - the gap.

setOutlinePaint

public void setOutlinePaint(Paint paint)
Sets the outline paint.
Parameters:
paint - the paint.

setOutlineStroke

public void setOutlineStroke(Stroke stroke)
Sets the outline stroke.
Parameters:
stroke - the stroke.

setShadowPaint

public void setShadowPaint(Paint paint)
Sets the shadow paint.
Parameters:
paint - the paint.

setShadowXOffset

public void setShadowXOffset(double offset)
Sets the x-offset for the shadow effect.
Parameters:
offset - the offset (in Java2D units).

setShadowYOffset

public void setShadowYOffset(double offset)
Sets the y-offset for the shadow effect.
Parameters:
offset - the offset (in Java2D units).

setTextBlock

public void setTextBlock(TextBlock block)
Sets the text block.
Parameters:
block - the block.