Package org.opensourcephysics.display
Class InteractiveTextLine
java.lang.Object
org.opensourcephysics.display.AbstractInteractive
org.opensourcephysics.display.InteractiveShape
org.opensourcephysics.display.InteractiveTextLine
- All Implemented Interfaces:
Drawable,Interactive,Measurable
- Direct Known Subclasses:
PencilCaption
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
Nested ClassesModifier and TypeClassDescriptionprotected static classA class to save and load InteractiveArrow in an XMLControl.Nested classes/interfaces inherited from class org.opensourcephysics.display.InteractiveShape
InteractiveShape.InteractiveShapeLoader -
Field Summary
FieldsFields inherited from class org.opensourcephysics.display.InteractiveShape
edgeColor, height, pixelPt, pixelSized, shape, shapeClass, theta, toPixels, trIS, width, xoff, yoffFields inherited from class org.opensourcephysics.display.AbstractInteractive
color, x, y -
Constructor Summary
ConstructorsConstructorDescriptionInteractiveTextLine(String text, double x, double y) Constructs an interactive TextLinme with the given text and location. -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(DrawingPanel panel, Graphics g) Draws the text.getFont()Gets the font used to display the text.static XML.ObjectLoaderGets the XML object loader for this class.getText()Gets the text to be dispalyed.booleanisInside(DrawingPanel panel, int xpix, int ypix) Determines if the shape is enabled and if the given pixel coordinates are within the image.voidSets the font used to display the text.voidsetJustification(int justification) Sets the justification to center, left, or right.voidSets the text to be displayed.Methods inherited from class org.opensourcephysics.display.InteractiveShape
contains, createArrow, createCenteredArrow, createCircle, createEllipse, createImage, createRectangle, createSquare, createTextLine, createTriangle, getHeight, getPixelPt, getRotateInstance, getRotateInstance, getScaleInstance, getShape, getTranslateInstance, getWidth, getXMax, getXMin, getYMax, getYMin, isMeasured, setHeight, setMarkerColor, setMeasured, setOffset, setPixelSized, setTheta, setWidth, setX, setXY, setY, toString, tranform, transformMethods inherited from class org.opensourcephysics.display.AbstractInteractive
findInteractive, getX, getY, isEnabled, setEnabledMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
textLine
-
-
Constructor Details
-
InteractiveTextLine
Constructs an interactive TextLinme with the given text and location.- Parameters:
text- Stringx- doubley- double
-
-
Method Details
-
setJustification
public void setJustification(int justification) Sets the justification to center, left, or right.TextLine.CENTER, TextLine.LEFT, TextLine.RIGHT- Parameters:
justification- int
-
setText
Sets the text to be displayed.- Parameters:
text- String
-
getText
Gets the text to be dispalyed.- Returns:
- String
-
setFont
Sets the font used to display the text.- Parameters:
font- Font
-
getFont
Gets the font used to display the text.- Returns:
- Font
-
isInside
Determines if the shape is enabled and if the given pixel coordinates are within the image.- Overrides:
isInsidein classInteractiveShape- Parameters:
panel- DrawingPanelxpix- intypix- int- Returns:
- boolean
-
draw
Draws the text.- Specified by:
drawin interfaceDrawable- Overrides:
drawin classInteractiveShape- Parameters:
panel- the world in which the arrow is viewedg- the graphics context upon which to draw
-
getLoader
Gets the XML object loader for this class.- Returns:
- ObjectLoader
-