Class CartesianType2
java.lang.Object
org.opensourcephysics.display.axes.AbstractAxes
org.opensourcephysics.display.axes.CartesianType2
- All Implemented Interfaces:
CartesianAxes,DrawableAxes,Drawable
-
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
ConstructorsConstructorDescriptionCartesianType2(PlottingPanel panel) CartesianType2 draws axes in the drawing panel's gutter. -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(DrawingPanel panel, Graphics g) Draws the axes in the drawing panel.getTitle()Gets the title.doublegetX()Gets the drawing location.Gets the x axis label.doublegetY()Gets the drawing location.Gets the y axis label.booleanisXLog()Determines if the x axis is logarithmic.booleanisYLog()Deteermines if the y axis is logarithmic.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 the title.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.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.Drawable
isInteractiveMethods inherited from interface org.opensourcephysics.display.axes.DrawableAxes
getInteriorBackground, resizeFonts, setVisible
-
Constructor Details
-
CartesianType2
CartesianType2 draws axes in the drawing panel's gutter. The default gutters are set to 50, 25, 25, 5.- 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 labelfont_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 labelfont_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
-
setTitle
Set the title. The title is drawn centered near the top of 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 labelfont_name- an optional font name
-
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
-
setX
public void setX(double x) Description copied from interface:CartesianAxesSets the drawing location.- Specified by:
setXin interfaceCartesianAxes
-
setY
public void setY(double y) Description copied from interface:CartesianAxesSets the drawing location.- Specified by:
setYin interfaceCartesianAxes
-
getX
public double getX()Description copied from interface:CartesianAxesGets the drawing location.- Specified by:
getXin interfaceCartesianAxes- Returns:
- the x location
-
getY
public double getY()Description copied from interface:CartesianAxesGets the drawing location.- Specified by:
getYin interfaceCartesianAxes- Returns:
- the y location
-