Class CartesianInteractive
java.lang.Object
org.opensourcephysics.display.axes.AbstractAxes
org.opensourcephysics.display.axes.CartesianType1
org.opensourcephysics.display.axes.CartesianInteractive
- All Implemented Interfaces:
CartesianAxes,DrawableAxes,Dimensioned,Drawable,Interactive,Measurable,Selectable
- Direct Known Subclasses:
DataToolTab.DataToolAxes
A cartesian axis class that provides interactive scale adjustment with a
mouse.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassA dialog with value field and autoscale checkbox. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class org.opensourcephysics.display.axes.CartesianType1
htFormats, xLine, yLineFields inherited from class org.opensourcephysics.display.axes.AbstractAxes
defaultBottomGutter, defaultLeftGutter, defaultRightGutter, defaultTopGutter, drawingPanel, gridcolor, interiorColor, labelFont, labelFormat, superscriptFont, titleFont, titleLine, visible -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a set of interactive axes for a plotting panel. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAxisListener(ActionListener listener) voiddispose()voiddraw(DrawingPanel panel, Graphics g) Draws the axes.findInteractive(DrawingPanel panel, int xpix, int ypix) protected intfindRegion(Point p, boolean isPress) Finds the plot region containing the specified point.protected JPopupMenuGets a popup menu with horizontal axis variables.intGets the current plot region containing the mouse.Gets the scale setter.protected JPopupMenuGets a popup menu with vertical axis variables.doublegetX()Gets the drawing location.doublegetXMax()Gets the maximum x needed to draw this object.doublegetXMin()Gets the minimum x needed to draw this object.doublegetY()Gets the drawing location.doublegetYMax()Gets the maximum y needed to draw this object.doublegetYMin()Gets the minimum y needed to draw this object.protected booleanReports whether this provides a popup menu for setting the horizontal axis variable.protected booleanReports whether this provides a popup menu for setting the vertical axis variable.voidHides the scale setter.booleanbooleanDetermines if information is available to set min/max values.booleanvoidRefreshes the format cache and decimal separatorvoidresizeFonts(double factor, DrawingPanel panel) Resizes fonts by the specified factor.voidsetEnabled(boolean enable) voidsetSelected(boolean selectable) voidsetXY(double x, double y) voidMethods inherited from class org.opensourcephysics.display.axes.CartesianType1
addXTick, addYTick, drawPlot, getInterior, getTickLength, getTitle, getXLabel, getYLabel, isXLog, isYLog, setLabelFont, setShowMajorXGrid, setShowMajorYGrid, setShowMinorXGrid, setShowMinorYGrid, setTickLength, setTitle, setTitleFont, setX, setXLabel, setXLog, setY, setYLabel, setYLogMethods inherited from class org.opensourcephysics.display.axes.AbstractAxes
getInteriorBackground, isVisible, resetPanelGutters, setDefaultGutters, setInteriorBackground, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensourcephysics.display.axes.DrawableAxes
getInteriorBackground, setInteriorBackground, setVisibleMethods inherited from interface org.opensourcephysics.display.Interactive
isInteractive, setX, setY
-
Field Details
-
INSIDE
public static final int INSIDE- See Also:
-
HORZ_MIN
public static final int HORZ_MIN- See Also:
-
HORZ_MAX
public static final int HORZ_MAX- See Also:
-
VERT_MIN
public static final int VERT_MIN- See Also:
-
VERT_MAX
public static final int VERT_MAX- See Also:
-
HORZ_AXIS
public static final int HORZ_AXIS- See Also:
-
HORZ_AXIS_MIN
public static final int HORZ_AXIS_MIN- See Also:
-
HORZ_AXIS_MAX
public static final int HORZ_AXIS_MAX- See Also:
-
VERT_AXIS
public static final int VERT_AXIS- See Also:
-
VERT_AXIS_MIN
public static final int VERT_AXIS_MIN- See Also:
-
VERT_AXIS_MAX
public static final int VERT_AXIS_MAX- See Also:
-
HORZ_VAR
public static final int HORZ_VAR- See Also:
-
VERT_VAR
public static final int VERT_VAR- See Also:
-
-
Constructor Details
-
CartesianInteractive
Constructs a set of interactive axes for a plotting panel.- Parameters:
panel- the PlottingPanel
-
-
Method Details
-
getMouseRegion
public int getMouseRegion()Gets the current plot region containing the mouse.- Returns:
- one of the static plot regions defined by CartesianInteractive, or -1
-
draw
Draws the axes.- Specified by:
drawin interfaceDrawable- Overrides:
drawin classCartesianType1- Parameters:
panel- the drawing panelg- the graphics context
-
getX
public double getX()Description copied from interface:CartesianAxesGets the drawing location.- Specified by:
getXin interfaceCartesianAxes- Specified by:
getXin interfaceInteractive- Overrides:
getXin classCartesianType1- Returns:
- the x location
-
getY
public double getY()Description copied from interface:CartesianAxesGets the drawing location.- Specified by:
getYin interfaceCartesianAxes- Specified by:
getYin interfaceInteractive- Overrides:
getYin classCartesianType1- Returns:
- the y location
-
setSelected
public void setSelected(boolean selectable) - Specified by:
setSelectedin interfaceSelectable
-
isSelected
public boolean isSelected()- Specified by:
isSelectedin interfaceSelectable
-
toggleSelected
public void toggleSelected()- Specified by:
toggleSelectedin interfaceSelectable
-
getPreferredCursor
- Specified by:
getPreferredCursorin interfaceSelectable
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceInteractive
-
setEnabled
public void setEnabled(boolean enable) - Specified by:
setEnabledin interfaceInteractive
-
addAxisListener
-
findInteractive
- Specified by:
findInteractivein interfaceInteractive
-
setXY
public void setXY(double x, double y) - Specified by:
setXYin interfaceInteractive
-
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
-
hideScaleSetter
public void hideScaleSetter()Hides the scale setter. -
resizeFonts
Resizes fonts by the specified factor.- Specified by:
resizeFontsin interfaceDrawableAxes- Overrides:
resizeFontsin classCartesianType1- Parameters:
factor- the factorpanel- the drawing panel on which these axes are drawn
-
dispose
public void dispose() -
hasHorzVariablesPopup
protected boolean hasHorzVariablesPopup()Reports whether this provides a popup menu for setting the horizontal axis variable.- Returns:
- true if this has a popup menu with horizontal axis variables
-
getHorzVariablesPopup
Gets a popup menu with horizontal axis variables. This default method returns null; subclasses should override to return a popup with associated action for setting horizontal axis variable.- Returns:
- the popup menu
-
hasVertVariablesPopup
protected boolean hasVertVariablesPopup()Reports whether this provides a popup menu for setting the vertical axis variable.- Returns:
- true if this has a popup menu with vertical axis variables
-
getVertVariablesPopup
Gets a popup menu with vertical axis variables. This default method returns null; subclasses should override to return a popup with associated action for setting vertical axis variable.- Returns:
- the popup menu
-
findRegion
Finds the plot region containing the specified point.- Parameters:
p- the point- Returns:
- one of the static regions defined by CartesianInteractive
-
getScaleSetter
Gets the scale setter.- Returns:
- the ScaleSetter dialog
-
refreshDecimalSeparators
public void refreshDecimalSeparators()Refreshes the format cache and decimal separator
-