Class PencilCaption
java.lang.Object
org.opensourcephysics.display.AbstractInteractive
org.opensourcephysics.display.InteractiveShape
org.opensourcephysics.display.InteractiveTextLine
org.opensourcephysics.cabrillo.tracker.PencilCaption
- All Implemented Interfaces:
Drawable
,Interactive
,Measurable
A PencilCaption is a text caption for a PencilScene.
- Author:
- Douglas Brown
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opensourcephysics.display.InteractiveTextLine
InteractiveTextLine.InteractiveTextLineLoader
Nested classes/interfaces inherited from class org.opensourcephysics.display.InteractiveShape
InteractiveShape.InteractiveShapeLoader
-
Field Summary
Fields inherited from class org.opensourcephysics.display.InteractiveTextLine
textLine
Fields 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
ConstructorsConstructorDescriptionPencilCaption
(String text, double x, double y, Font font) Constructs a PencilCaption with specified text, position and font. -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(DrawingPanel panel, Graphics g) Draws the text.findInteractive
(DrawingPanel panel, int xpix, int ypix) Finds the interactive object that will respond to mouse actions.static XML.ObjectLoader
Returns the XML.ObjectLoader for this class.double
getXMax()
Implements measurable by getting the x center of the circle.double
getXMin()
Implements measurable by getting the x center of the circle.double
getYMax()
Implements measurable by getting the y center of the circle.double
getYMin()
Implements measurable by getting the y center of the circle.protected boolean
handleMouseAction
(MouseEvent e, TrackerPanel trackerPanel) Handles mouse events for a TrackerPanel.boolean
Determines if this circle should effect the scale of a drawing panel.void
Sets the font used to display the text.void
Sets the text to be displayed.Methods inherited from class org.opensourcephysics.display.InteractiveTextLine
getFont, getText, isInside, setJustification
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, setHeight, setMarkerColor, setMeasured, setOffset, setPixelSized, setTheta, setWidth, setX, setXY, setY, toString, tranform, transform
Methods inherited from class org.opensourcephysics.display.AbstractInteractive
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
-
Constructor Details
-
PencilCaption
Constructs a PencilCaption with specified text, position and font.- Parameters:
text
- the textx
- the x-positiony
- the y-positionfont
- the font
-
-
Method Details
-
draw
Description copied from class:InteractiveTextLine
Draws the text.- Specified by:
draw
in interfaceDrawable
- Overrides:
draw
in classInteractiveTextLine
- Parameters:
panel
- the world in which the arrow is viewedg
- the graphics context upon which to draw
-
findInteractive
Description copied from class:AbstractInteractive
Finds the interactive object that will respond to mouse actions.- Specified by:
findInteractive
in interfaceInteractive
- Overrides:
findInteractive
in classAbstractInteractive
- Parameters:
panel
- DrawingPanelxpix
- intypix
- int- Returns:
- Interactive
-
setText
Description copied from class:InteractiveTextLine
Sets the text to be displayed.- Overrides:
setText
in classInteractiveTextLine
- Parameters:
text
- String
-
setFont
Description copied from class:InteractiveTextLine
Sets the font used to display the text.- Overrides:
setFont
in classInteractiveTextLine
- Parameters:
font
- Font
-
isMeasured
public boolean isMeasured()Description copied from class:InteractiveShape
Determines if this circle should effect the scale of a drawing panel.- Specified by:
isMeasured
in interfaceMeasurable
- Overrides:
isMeasured
in classInteractiveShape
- Returns:
- minimum
-
getXMin
public double getXMin()Description copied from class:InteractiveShape
Implements measurable by getting the x center of the circle.- Specified by:
getXMin
in interfaceMeasurable
- Overrides:
getXMin
in classInteractiveShape
- Returns:
- minimum
-
getXMax
public double getXMax()Description copied from class:InteractiveShape
Implements measurable by getting the x center of the circle.- Specified by:
getXMax
in interfaceMeasurable
- Overrides:
getXMax
in classInteractiveShape
- Returns:
- maximum
-
getYMin
public double getYMin()Description copied from class:InteractiveShape
Implements measurable by getting the y center of the circle.- Specified by:
getYMin
in interfaceMeasurable
- Overrides:
getYMin
in classInteractiveShape
- Returns:
- minimum
-
getYMax
public double getYMax()Description copied from class:InteractiveShape
Implements measurable by getting the y center of the circle.- Specified by:
getYMax
in interfaceMeasurable
- Overrides:
getYMax
in classInteractiveShape
- Returns:
- maximum
-
handleMouseAction
Handles mouse events for a TrackerPanel.- Parameters:
trackerPanel
- the TrackerPanele
- the mouse event
-
getLoader
Returns the XML.ObjectLoader for this class.- Returns:
- the object loader
-