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 class
A 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, yoff
Fields 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 TypeMethodDescriptionvoid
draw
(DrawingPanel panel, Graphics g) Draws the text.getFont()
Gets the font used to display the text.static XML.ObjectLoader
Gets the XML object loader for this class.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
Sets the font used to display the text.void
setJustification
(int justification) Sets the justification to center, left, or right.void
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, getPixelPt, getRotateInstance, getRotateInstance, getScaleInstance, getShape, getTranslateInstance, 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
Methods 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:
isInside
in classInteractiveShape
- Parameters:
panel
- DrawingPanelxpix
- intypix
- int- Returns:
- boolean
-
draw
Draws the text.- Specified by:
draw
in interfaceDrawable
- Overrides:
draw
in 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
-