org.opensourcephysics.display
Class InteractiveTextLine

java.lang.Object
  extended by org.opensourcephysics.display.AbstractInteractive
      extended by org.opensourcephysics.display.InteractiveShape
          extended by org.opensourcephysics.display.InteractiveTextLine
All Implemented Interfaces:
Drawable, Interactive, Measurable

public class InteractiveTextLine
extends InteractiveShape

An InteractiveTextLine is a single line of text that can be moved and rotated like other interactive shapes.

Version:
1.0
Author:
Wolfgang Christian

Nested Class Summary
protected static class InteractiveTextLine.InteractiveTextLineLoader
          A class to save and load InteractiveArrow in an XMLControl.
 
Nested classes/interfaces inherited from class org.opensourcephysics.display.InteractiveShape
InteractiveShape.InteractiveShapeLoader
 
Field Summary
 
Fields inherited from class org.opensourcephysics.display.InteractiveShape
edgeColor, height, pixelSized, shape, shapeClass, theta, width, xoff, yoff
 
Fields inherited from class org.opensourcephysics.display.AbstractInteractive
color, x, y
 
Constructor Summary
InteractiveTextLine(java.lang.String text, double x, double y)
          Constructs an interactive TextLinme with the given text and location.
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the text.
 java.awt.Font getFont()
          Gets the font used to display the text.
static XML.ObjectLoader getLoader()
          Gets the XML object loader for this class.
 java.lang.String getText()
          Gets the text to be dispalyed.
 boolean isInside(DrawingPanel panel, int xpix, int ypix)
          Determines if the shape is enabled and if the given pixel coordinates are within the image.
 void setFont(java.awt.Font font)
          Sets the font used to display the text.
 void setJustification(int justification)
          Sets the justification to center, left, or right.
 void setText(java.lang.String text)
          Sets the text to be displayed.
 
Methods inherited from class org.opensourcephysics.display.InteractiveShape
contains, createArrow, createCenteredArrow, createCircle, createEllipse, createImage, createRectangle, createSquare, createTextLine, createTriangle, getHeight, getShape, getWidth, getXMax, getXMin, getYMax, getYMin, isMeasured, setHeight, setMarkerColor, setMeasured, setOffset, setPixelSized, setTheta, setWidth, setX, setXY, setY, toString, tranform, transform
 
Methods inherited from class org.opensourcephysics.display.AbstractInteractive
findInteractive, getX, getY, isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InteractiveTextLine

public InteractiveTextLine(java.lang.String text,
                           double x,
                           double y)
Constructs an interactive TextLinme with the given text and location.

Parameters:
text - String
x - double
y - double
Method Detail

setJustification

public void setJustification(int justification)
Sets the justification to center, left, or right. TextLine.CENTER, TextLine.LEFT, TextLine.RIGHT

Parameters:
justification - int

setText

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

Parameters:
text - String

getText

public java.lang.String getText()
Gets the text to be dispalyed.

Returns:
String

setFont

public void setFont(java.awt.Font font)
Sets the font used to display the text.

Parameters:
font - Font

getFont

public java.awt.Font getFont()
Gets the font used to display the text.

Returns:
Font

isInside

public boolean isInside(DrawingPanel panel,
                        int xpix,
                        int ypix)
Determines if the shape is enabled and if the given pixel coordinates are within the image.

Overrides:
isInside in class InteractiveShape
Parameters:
panel - DrawingPanel
xpix - int
ypix - int
Returns:
boolean

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the text.

Specified by:
draw in interface Drawable
Overrides:
draw in class InteractiveShape
Parameters:
panel - the world in which the arrow is viewed
g - the graphics context upon which to draw

getLoader

public static XML.ObjectLoader getLoader()
Gets the XML object loader for this class.

Returns:
ObjectLoader