jET
1.0beta1


org.jet.sce
Class TextBox

java.lang.Object
  |
  +--org.jet.sce.TextBox

public class TextBox
extends java.lang.Object

This is a box surrounding text. It is like geometric figure.


Field Summary
protected  java.awt.font.TextLayout text
          The text object.
 
Constructor Summary
TextBox(java.lang.String name, java.awt.Font font, java.awt.font.FontRenderContext frc)
          Constructs text box at point (0, 0).
 
Method Summary
 boolean contains(java.awt.Rectangle r)
          Determines if the text box contains given rectangle.
 void draw(java.awt.Graphics2D g)
          Draws the text box on the graphics context.
 java.awt.Rectangle getBounds()
          Gets the bounds of the text layout and rectangle anround it.
 java.awt.geom.Rectangle2D getBounds2D()
          Gets the bounds of the text layout and rectangle anround it.
 java.awt.geom.Point2D getLocation()
          Gets the location point.
 java.awt.font.TextLayout getText()
          Gets the text layout for the text box.
 double getX()
          Gets the X coordinate of the location.
 double getY()
          Gets the Y coordinate of the location.
 boolean intersects(java.awt.Rectangle r)
          Determines if the text box intersects with given rectangle.
 void setLocation(double x, double y)
          Sets location to the given point.
 void setLocation(java.awt.geom.Point2D p)
          Sets location of the text box to the point.
 void setText(java.awt.font.TextLayout text)
          Sets the text layout for the text box.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

protected java.awt.font.TextLayout text
The text object.

Constructor Detail

TextBox

public TextBox(java.lang.String name,
               java.awt.Font font,
               java.awt.font.FontRenderContext frc)
Constructs text box at point (0, 0).

Parameters:
name - Track name.
font - The font.
frc - Font rendering context.
Method Detail

setLocation

public void setLocation(double x,
                        double y)
Sets location to the given point.

Parameters:
x - X coordinate.
y - Y coordinate.

setLocation

public void setLocation(java.awt.geom.Point2D p)
Sets location of the text box to the point.

Parameters:
p - New point.

getY

public double getY()
Gets the Y coordinate of the location.


getX

public double getX()
Gets the X coordinate of the location.


getLocation

public java.awt.geom.Point2D getLocation()
Gets the location point.


draw

public void draw(java.awt.Graphics2D g)
Draws the text box on the graphics context. This method draws the text and rectangle around it.


setText

public void setText(java.awt.font.TextLayout text)
Sets the text layout for the text box.


getText

public java.awt.font.TextLayout getText()
Gets the text layout for the text box.


intersects

public boolean intersects(java.awt.Rectangle r)
Determines if the text box intersects with given rectangle.

Parameters:
r - Rectangle to test.
Returns:
True, if this text box intersects with given rectangle.

contains

public boolean contains(java.awt.Rectangle r)
Determines if the text box contains given rectangle.

Parameters:
r - Rectangle to test.
Returns:
True, if this text box contains rectangle.

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Gets the bounds of the text layout and rectangle anround it.


getBounds

public java.awt.Rectangle getBounds()
Gets the bounds of the text layout and rectangle anround it.


jET
1.0beta1