Package org.opensourcephysics.display
Class InteractiveLabel
java.lang.Object
org.opensourcephysics.display.Circle
org.opensourcephysics.display.MeasuredCircle
org.opensourcephysics.display.InteractiveLabel
- All Implemented Interfaces:
Drawable
,Interactive
,Measurable
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor InteractiveLabelInteractiveLabel
(String str) Constructor InteractiveLabel -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw
(DrawingPanel panel, Graphics g) Draws the circle.findInteractive
(DrawingPanel panel, int xpix, int ypix) int
Gets the label's offset in the x direction.int
Gets the label's offset in the y direction.boolean
Gets the mouse interaction enabled property.boolean
isInside
(DrawingPanel panel, int xpix, int ypix) Checks to see if this object is enabled and if the pixel coordinates are inside the drawable.void
void
setConnectionPoint
(int location) Sets the location of the connection point.void
setEnabled
(boolean enabled) Enables mouse interactionsvoid
setOffsetX
(int offset) Sets the label's offset in the x direction.void
setOffsetY
(int offset) Sets the label's offset in the y direction.void
void
void
setXY
(double _x, double _y) Sets the x and y coordinates.Methods inherited from class org.opensourcephysics.display.MeasuredCircle
getLoader, getXMax, getXMin, getYMax, getYMin, isMeasured, setMeasured
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
getX, getY, isInteractive, setX, setY
Methods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
-
Field Details
-
TOP_LEFT_LOCATION
public static final int TOP_LEFT_LOCATION- See Also:
-
CENTER_LOCATION
public static final int CENTER_LOCATION- See Also:
-
TOP_CENTER_LOCATION
public static final int TOP_CENTER_LOCATION- See Also:
-
connection_location
public int connection_location -
text
-
font
-
fontname
-
fontsize
protected int fontsize -
fontstyle
protected int fontstyle
-
-
Constructor Details
-
InteractiveLabel
public InteractiveLabel()Constructor InteractiveLabel -
InteractiveLabel
Constructor InteractiveLabel- Parameters:
str
-
-
-
Method Details
-
setXY
public void setXY(double _x, double _y) Description copied from class:Circle
Sets the x and y coordinates.- Specified by:
setXY
in interfaceInteractive
- Overrides:
setXY
in classCircle
-
setText
-
setText
-
resetBoxSize
public void resetBoxSize() -
setConnectionPoint
public void setConnectionPoint(int location) Sets the location of the connection point. Location values are:TOP_LEFT_LOCATION, TOP_CENTER_LOCATION- Parameters:
location
- int
-
setOffsetX
public void setOffsetX(int offset) Sets the label's offset in the x direction.- Parameters:
offset
- int
-
getOffsetX
public int getOffsetX()Gets the label's offset in the x direction. -
setOffsetY
public void setOffsetY(int offset) Sets the label's offset in the y direction.- Parameters:
offset
- int
-
getOffsetY
public int getOffsetY()Gets the label's offset in the y direction. -
draw
Description copied from class:Circle
Draws the circle. -
findInteractive
- Specified by:
findInteractive
in interfaceInteractive
-
isInside
Checks to see if this object is enabled and if the pixel coordinates are inside the drawable.- Parameters:
panel
-xpix
-ypix
-- Returns:
- true if the pixel coordinates are inside; false otherwise
-
setEnabled
public void setEnabled(boolean enabled) Enables mouse interactions- Specified by:
setEnabled
in interfaceInteractive
- Parameters:
enabled
- boolean
-
isEnabled
public boolean isEnabled()Gets the mouse interaction enabled property.- Specified by:
isEnabled
in interfaceInteractive
- Returns:
- boolean
-