Class CartesianType3
java.lang.Object
org.opensourcephysics.display.axes.AbstractAxes
org.opensourcephysics.display.axes.CartesianType3
- All Implemented Interfaces:
CartesianAxes,DrawableAxes,Drawable,Interactive,Measurable
CartesianType3 draws draggable X and Y axes in the interior of a plotting panel.
- Author:
- W. Christian
-
Field Summary
Fields inherited from class org.opensourcephysics.display.axes.AbstractAxes
defaultBottomGutter, defaultLeftGutter, defaultRightGutter, defaultTopGutter, drawingPanel, gridcolor, interiorColor, labelFont, labelFormat, superscriptFont, titleFont, titleLine, visible -
Constructor Summary
ConstructorsConstructorDescriptionCartesianType3(PlottingPanel panel) Constructs the XYAxes inside the drawing panel. -
Method Summary
Modifier and TypeMethodDescriptionvoidcenterAxes(DrawingPanel panel) voiddraw(DrawingPanel panel, Graphics g) Draws the axes in the drawing panel.findInteractive(DrawingPanel panel, int xpix, int ypix) getTitle()Gets the title.doublegetX()Gets the drawing location.Gets the x axis label.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.Gets the y axis label.doublegetYMax()Gets the maximum y needed to draw this object.doublegetYMin()Gets the minimum y needed to draw this object.booleanbooleanDetermines if information is available to set min/max values.booleanisXLog()Determines if the x axis is logarithmic.booleanisYLog()Deteermines if the y axis is logarithmic.voidsetEnabled(boolean _enabled) voidsetInteriorBackground(Color color) Sets the interior background color.voidsetShowMajorXGrid(boolean showGrid) Shows a grid line for every x axis major tickmark.voidsetShowMajorYGrid(boolean showGrid) Shows a grid line for every y axis major tickmark.voidsetShowMinorXGrid(boolean showGrid) Shows a grid line for every x axis minor tickmark.voidsetShowMinorYGrid(boolean showGrid) Shows a grid line for every y axis minor tickmark.voidSet a title that will be drawn within the drawing panel.voidsetX(double x) Sets the drawing location.voidSets the x label of the axes.voidsetXLog(boolean isLog) Sets the x axis to linear or logarithmic.voidsetXY(double x, double y) voidsetY(double y) Sets the drawing location.voidSets the y label of the axes.voidsetYLog(boolean isLog) Sets the y axis to linear or logarithmic.Methods inherited from class org.opensourcephysics.display.axes.AbstractAxes
getInteriorBackground, isVisible, resetPanelGutters, resizeFonts, setDefaultGutters, 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, resizeFonts, setVisibleMethods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
-
Constructor Details
-
CartesianType3
Constructs the XYAxes inside the drawing panel. Drawing panel gutters are set to 30, 30, 30, 30.- Parameters:
panel- the drawing panel that will use the axes
-
-
Method Details
-
setXLabel
Sets the x label of the axes. The font names understood are those understood by java.awt.Font.decode(). If the font name is null, the font remains unchanged.- Specified by:
setXLabelin interfaceDrawableAxes- Parameters:
s- the titlefont_name- an optional font name
-
setYLabel
Sets the y label of the axes. The font names understood are those understood by java.awt.Font.decode(). If the font name is null, the font remains unchanged.- Specified by:
setYLabelin interfaceDrawableAxes- Parameters:
s- the titlefont_name- an optional font name
-
setTitle
Set a title that will be drawn within the drawing panel. The font names understood are those understood by java.awt.Font.decode(). If the font name is null, the font remains unchanged.- Specified by:
setTitlein interfaceDrawableAxes- Overrides:
setTitlein classAbstractAxes- Parameters:
s- the titlefont_name- an optional font name
-
getXLabel
Gets the x axis label.- Specified by:
getXLabelin interfaceDrawableAxes- Returns:
- String
-
getYLabel
Gets the y axis label.- Specified by:
getYLabelin interfaceDrawableAxes- Returns:
- String
-
getTitle
Gets the title.- Specified by:
getTitlein interfaceDrawableAxes- Overrides:
getTitlein classAbstractAxes- Returns:
- String
-
setXLog
public void setXLog(boolean isLog) Sets the x axis to linear or logarithmic.- Specified by:
setXLogin interfaceCartesianAxes- Parameters:
isLog- true for log scale; false otherwise
-
setYLog
public void setYLog(boolean isLog) Sets the y axis to linear or logarithmic.- Specified by:
setYLogin interfaceCartesianAxes- Parameters:
isLog- true for log scale; false otherwise
-
isXLog
public boolean isXLog()Description copied from interface:CartesianAxesDetermines if the x axis is logarithmic.- Specified by:
isXLogin interfaceCartesianAxes- Returns:
- true if logarithmic; false otherwise
-
isYLog
public boolean isYLog()Description copied from interface:CartesianAxesDeteermines if the y axis is logarithmic.- Specified by:
isYLogin interfaceCartesianAxes- Returns:
- true if logarithmic; false otherwise
-
draw
Draws the axes in the drawing panel. -
setInteriorBackground
Sets the interior background color.- Specified by:
setInteriorBackgroundin interfaceDrawableAxes- Overrides:
setInteriorBackgroundin classAbstractAxes- Parameters:
color- The new interiorBackground value
-
setShowMajorXGrid
public void setShowMajorXGrid(boolean showGrid) Shows a grid line for every x axis major tickmark.- Specified by:
setShowMajorXGridin interfaceDrawableAxes
-
setShowMinorXGrid
public void setShowMinorXGrid(boolean showGrid) Shows a grid line for every x axis minor tickmark.- Specified by:
setShowMinorXGridin interfaceDrawableAxes
-
setShowMajorYGrid
public void setShowMajorYGrid(boolean showGrid) Shows a grid line for every y axis major tickmark.- Specified by:
setShowMajorYGridin interfaceDrawableAxes
-
setShowMinorYGrid
public void setShowMinorYGrid(boolean showGrid) Shows a grid line for every y axis minor tickmark.- Specified by:
setShowMinorYGridin interfaceDrawableAxes
-
centerAxes
-
setEnabled
public void setEnabled(boolean _enabled) - Specified by:
setEnabledin interfaceInteractive
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceInteractive
-
setXY
public void setXY(double x, double y) - Specified by:
setXYin interfaceInteractive
-
setX
public void setX(double x) Description copied from interface:CartesianAxesSets the drawing location.- Specified by:
setXin interfaceCartesianAxes- Specified by:
setXin interfaceInteractive
-
setY
public void setY(double y) Description copied from interface:CartesianAxesSets the drawing location.- Specified by:
setYin interfaceCartesianAxes- Specified by:
setYin interfaceInteractive
-
getX
public double getX()Description copied from interface:CartesianAxesGets the drawing location.- Specified by:
getXin interfaceCartesianAxes- Specified by:
getXin interfaceInteractive- Returns:
- the x location
-
getY
public double getY()Description copied from interface:CartesianAxesGets the drawing location.- Specified by:
getYin interfaceCartesianAxes- Specified by:
getYin interfaceInteractive- Returns:
- the y location
-
getXMin
public double getXMin()Gets the minimum x needed to draw this object.- Specified by:
getXMinin interfaceMeasurable- Returns:
- minimum
-
getXMax
public double getXMax()Gets the maximum x needed to draw this object.- Specified by:
getXMaxin interfaceMeasurable- Returns:
- maximum
-
getYMin
public double getYMin()Gets the minimum y needed to draw this object.- Specified by:
getYMinin interfaceMeasurable- Returns:
- minimum
-
getYMax
public double getYMax()Gets the maximum y needed to draw this object.- Specified by:
getYMaxin interfaceMeasurable- Returns:
- minimum
-
isMeasured
public boolean isMeasured()Determines if information is available to set min/max values. Objects that store data, Datasets for example, usually return false if data is null.- Specified by:
isMeasuredin interfaceMeasurable- Returns:
- true if min/max values are valid
-
findInteractive
- Specified by:
findInteractivein interfaceInteractive
-