org.opensourcephysics.display3d.simple3d
Class ElementText

java.lang.Object
  extended by org.opensourcephysics.display3d.simple3d.Element
      extended by org.opensourcephysics.display3d.simple3d.ElementText
All Implemented Interfaces:
Element, ElementText, InteractionSource

public class ElementText
extends Element
implements ElementText

Title: ElementText

Description: A Text using the painter's algorithm

Version:
March 2005
Author:
Francisco Esquembre

Field Summary
 
Fields inherited from class org.opensourcephysics.display3d.simple3d.Element
targetPosition, targetSize
 
Fields inherited from interface org.opensourcephysics.display3d.core.ElementText
JUSTIFICATION_CENTER, JUSTIFICATION_LEFT, JUSTIFICATION_RIGHT
 
Fields inherited from interface org.opensourcephysics.display3d.core.Element
TARGET_POSITION, TARGET_SIZE
 
Constructor Summary
ElementText()
          Constructor ElementText
ElementText(java.lang.String text)
          Constructor ElementText
 
Method Summary
 java.awt.Font getFont()
          Gets the font of the text
 int getJustification()
          Gets the justification of the text
static XML.ObjectLoader getLoader()
          Returns an XML.ObjectLoader to save and load object data.
 double getRotationAngle()
          Gets the rotation angle for the text
protected  InteractionTarget getTargetHit(int x, int y)
          Gets the target that is under the (x,y) position of the screen
 java.lang.String getText()
          Gets the text displayed
 void setFont(java.awt.Font font)
          Sets the font for the text
 void setJustification(int justification)
          Sets the justification for the text
 void setRotationAngle(double angle)
          Sets the rotation angle for the text.
 void setText(java.lang.String text)
          Sets the text to be displayed
 
Methods inherited from class org.opensourcephysics.display3d.simple3d.Element
addInteractionListener, getAxesMode, getDrawingPanel3D, getHotSpotBodyCoordinates, getInteractionTarget, getName, getSizeX, getSizeY, getSizeZ, getStyle, getTransformation, getX, getY, getZ, isReallyVisible, isVisible, loadUnmutableObjects, removeInteractionListener, setName, setSizeX, setSizeXYZ, setSizeXYZ, setSizeY, setSizeZ, setTransformation, setVisible, setX, setXYZ, setXYZ, setY, setZ, toBodyFrame, toSpaceFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display3d.core.Element
getDrawingPanel3D, getName, getSizeX, getSizeY, getSizeZ, getStyle, getTransformation, getX, getY, getZ, isVisible, loadUnmutableObjects, setName, setSizeX, setSizeXYZ, setSizeXYZ, setSizeY, setSizeZ, setTransformation, setVisible, setX, setXYZ, setXYZ, setY, setZ, toBodyFrame, toSpaceFrame
 
Methods inherited from interface org.opensourcephysics.display3d.core.interaction.InteractionSource
addInteractionListener, getInteractionTarget, removeInteractionListener
 

Constructor Detail

ElementText

public ElementText()
Constructor ElementText


ElementText

public ElementText(java.lang.String text)
Constructor ElementText

Parameters:
text -
Method Detail

setText

public void setText(java.lang.String text)
Description copied from interface: ElementText
Sets the text to be displayed

Specified by:
setText in interface ElementText
Parameters:
text - the String

getText

public java.lang.String getText()
Description copied from interface: ElementText
Gets the text displayed

Specified by:
getText in interface ElementText

setFont

public void setFont(java.awt.Font font)
Description copied from interface: ElementText
Sets the font for the text

Specified by:
setFont in interface ElementText
Parameters:
font - Font

getFont

public java.awt.Font getFont()
Description copied from interface: ElementText
Gets the font of the text

Specified by:
getFont in interface ElementText
Returns:
Font

setJustification

public void setJustification(int justification)
Description copied from interface: ElementText
Sets the justification for the text

Specified by:
setJustification in interface ElementText

getJustification

public int getJustification()
Description copied from interface: ElementText
Gets the justification of the text

Specified by:
getJustification in interface ElementText
Returns:
Font

setRotationAngle

public void setRotationAngle(double angle)
Description copied from interface: ElementText
Sets the rotation angle for the text. Default is 0.

Specified by:
setRotationAngle in interface ElementText
Parameters:
angle - the rotation angle

getRotationAngle

public double getRotationAngle()
Description copied from interface: ElementText
Gets the rotation angle for the text

Specified by:
getRotationAngle in interface ElementText

getTargetHit

protected InteractionTarget getTargetHit(int x,
                                         int y)
Description copied from class: Element
Gets the target that is under the (x,y) position of the screen

Overrides:
getTargetHit in class Element
Parameters:
x - int
y - int
Returns:
InteractionTarget

getLoader

public static XML.ObjectLoader getLoader()
Returns an XML.ObjectLoader to save and load object data.

Returns:
the XML.ObjectLoader