edu.byu.phun2d
Class Text

java.lang.Object
  extended by edu.byu.phun2d.DrawObj
      extended by edu.byu.phun2d.Text

public class Text
extends DrawObj

This will draw a string of text on the screen. The drawing is specified by giving the X location of the left edge of the text and the Y location of the baseline. Note that the baseline is the bottom of most characters. Characters such as 'j' or 'g' descend below the baseline. The text is approximately 1 unit high. The size of the text can be varied by placing this object into a Group and then using the Group's scaling functionality. This can also be used to rotate the text.


Constructor Summary
Text(double left, double baseLine, java.lang.String text)
          Create a new text object.
 
Method Summary
 double getBaseLine()
          Returns the Y coordinate of the baseline of where the text is drawn.
 double getLeft()
          Returns the X coordinate of the left edge of where the text is drawn.
 java.lang.String getText()
          This will return the text string currently being drawn.
 void setLocation(double left, double baseline)
          This will change the location where the text is drawn.
 void setText(java.lang.String newText)
          This will change the text to be displayed.
 
Methods inherited from class edu.byu.phun2d.DrawObj
getFillColor, getLineColor, getLineWidth, getRotate, getScaleX, getScaleY, getTranslate, insideToOutside, outsideToInside, setFillColor, setLineColor, setLineWidth, setRotate, setScale, setTranslate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Text

public Text(double left,
            double baseLine,
            java.lang.String text)
Create a new text object.

Parameters:
left - the X coordinate of the left edge of the text.
baseLine - the Y coordinate of the baseline of the text.
text - the string to be drawn.
Method Detail

setText

public void setText(java.lang.String newText)
This will change the text to be displayed.

Parameters:
newText - the new text string to be drawn.

getText

public java.lang.String getText()
This will return the text string currently being drawn.

Returns:

setLocation

public void setLocation(double left,
                        double baseline)
This will change the location where the text is drawn.

Parameters:
left - the X coordinate of the left edge of the text.
baseline - the Y coordinate of the baseline of the text.

getLeft

public double getLeft()
Returns the X coordinate of the left edge of where the text is drawn.

Returns:

getBaseLine

public double getBaseLine()
Returns the Y coordinate of the baseline of where the text is drawn.

Returns: