Package org.opensourcephysics.display
Class AbstractInteractive
java.lang.Object
org.opensourcephysics.display.AbstractInteractive
- All Implemented Interfaces:
Drawable,Interactive,Measurable
- Direct Known Subclasses:
InteractiveShape
AbstractInteractive implements common Interactive methods.
- Version:
- 1.0
- Author:
- Wolfgang Christian
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voiddraw(DrawingPanel panel, Graphics g) Draws the object.findInteractive(DrawingPanel panel, int xpix, int ypix) Finds the interactive object that will respond to mouse actions.doublegetX()Gets the x coordinate.doublegetXMax()Gets the maximum x needed to draw this object.doublegetXMin()Gets the minimum x needed to draw this object.doublegetY()Gets the y coordinate.doublegetYMax()Gets the maximum y needed to draw this object.doublegetYMin()Gets the minimum y needed to draw this object.booleanabstract booleanisInside(DrawingPanel panel, int xpix, int ypix) Checks to see if this object is enabled and if the pixel coordinates are inside the drawable.booleanDetermines if information is available to set min/max values.voidsetEnabled(boolean _enabled) Sets the enabled flag.voidsetX(double _x) Sets the x coordinate.voidsetXY(double _x, double _y) Sets the x and y coordinates.voidsetY(double _y) Sets the y coordinate.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Field Details
-
color
-
x
protected double x -
y
protected double y
-
-
Constructor Details
-
AbstractInteractive
public AbstractInteractive()
-
-
Method Details
-
draw
Draws the object. -
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) Sets the enabled flag.- Specified by:
setEnabledin interfaceInteractive- Parameters:
_enabled-
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceInteractive
-
setXY
public void setXY(double _x, double _y) Sets the x and y coordinates.- Specified by:
setXYin interfaceInteractive- Parameters:
_x-_y-
-
findInteractive
Finds the interactive object that will respond to mouse actions.- Specified by:
findInteractivein interfaceInteractive- Parameters:
panel- DrawingPanelxpix- intypix- int- Returns:
- Interactive
-
isMeasured
public boolean isMeasured()Description copied from interface:MeasurableDetermines if information is available to set min/max values. Objects that store data should return false if data is null.- Specified by:
isMeasuredin interfaceMeasurable- Returns:
- true if min/max values are valid
-
getXMin
public double getXMin()Description copied from interface:MeasurableGets the minimum x needed to draw this object.- Specified by:
getXMinin interfaceMeasurable- Returns:
- minimum
-
getXMax
public double getXMax()Description copied from interface:MeasurableGets the maximum x needed to draw this object.- Specified by:
getXMaxin interfaceMeasurable- Returns:
- maximum
-
getYMin
public double getYMin()Description copied from interface:MeasurableGets the minimum y needed to draw this object.- Specified by:
getYMinin interfaceMeasurable- Returns:
- minimum
-
getYMax
public double getYMax()Description copied from interface:MeasurableGets the maximum y needed to draw this object.- Specified by:
getYMaxin interfaceMeasurable- Returns:
- minimum
-
getX
public double getX()Gets the x coordinate.- Specified by:
getXin interfaceInteractive- Returns:
- double x
-
setX
public void setX(double _x) Sets the x coordinate.- Specified by:
setXin interfaceInteractive- Parameters:
_x-
-
getY
public double getY()Gets the y coordinate.- Specified by:
getYin interfaceInteractive- Returns:
- double y
-
setY
public void setY(double _y) Sets the y coordinate.- Specified by:
setYin interfaceInteractive- Parameters:
_y-
-