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 TypeMethodDescriptionvoid
draw
(DrawingPanel panel, Graphics g) Draws the axes in the drawing panel.getTitle()
Gets the title.double
getX()
Gets the drawing location.Gets the x axis label.double
getY()
Gets the drawing location.Gets the y axis label.boolean
isXLog()
Determines if the x axis is logarithmic.boolean
isYLog()
Deteermines if the y axis is logarithmic.void
setInteriorBackground
(Color color) Sets the interior background color.void
setShowMajorXGrid
(boolean showGrid) Shows a grid line for every x axis major tickmark.void
setShowMajorYGrid
(boolean showGrid) Shows a grid line for every y axis major tickmark.void
setShowMinorXGrid
(boolean showGrid) Shows a grid line for every x axis minor tickmark.void
setShowMinorYGrid
(boolean showGrid) Shows a grid line for every y axis minor tickmark.void
Set the title.void
setX
(double x) Sets the drawing location.void
Sets the x label of the axes.void
setXLog
(boolean isLog) Sets the x axis to linear or logarithmic.void
setY
(double y) Sets the drawing location.void
Sets the y label of the axes.void
setYLog
(boolean isLog) Sets the y axis to linear or logarithmic.Methods inherited from class org.opensourcephysics.display.axes.AbstractAxes
getInteriorBackground, isVisible, resetPanelGutters, resizeFonts, setDefaultGutters, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Drawable
isInteractive
Methods 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:
setXLabel
in 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:
setYLabel
in interfaceDrawableAxes
- Parameters:
s
- the labelfont_name
- an optional font name
-
getXLabel
Gets the x axis label.- Specified by:
getXLabel
in interfaceDrawableAxes
- Returns:
- String
-
getYLabel
Gets the y axis label.- Specified by:
getYLabel
in interfaceDrawableAxes
- Returns:
- String
-
getTitle
Gets the title.- Specified by:
getTitle
in interfaceDrawableAxes
- Overrides:
getTitle
in 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:
setTitle
in interfaceDrawableAxes
- Overrides:
setTitle
in 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:
setXLog
in 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:
setYLog
in interfaceCartesianAxes
- Parameters:
isLog
- true for log scale; false otherwise
-
isXLog
public boolean isXLog()Description copied from interface:CartesianAxes
Determines if the x axis is logarithmic.- Specified by:
isXLog
in interfaceCartesianAxes
- Returns:
- true if logarithmic; false otherwise
-
isYLog
public boolean isYLog()Description copied from interface:CartesianAxes
Deteermines if the y axis is logarithmic.- Specified by:
isYLog
in interfaceCartesianAxes
- Returns:
- true if logarithmic; false otherwise
-
draw
Draws the axes in the drawing panel. -
setInteriorBackground
Sets the interior background color.- Specified by:
setInteriorBackground
in interfaceDrawableAxes
- Overrides:
setInteriorBackground
in 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:
setShowMajorXGrid
in interfaceDrawableAxes
-
setShowMinorXGrid
public void setShowMinorXGrid(boolean showGrid) Shows a grid line for every x axis minor tickmark.- Specified by:
setShowMinorXGrid
in interfaceDrawableAxes
-
setShowMajorYGrid
public void setShowMajorYGrid(boolean showGrid) Shows a grid line for every y axis major tickmark.- Specified by:
setShowMajorYGrid
in interfaceDrawableAxes
-
setShowMinorYGrid
public void setShowMinorYGrid(boolean showGrid) Shows a grid line for every y axis minor tickmark.- Specified by:
setShowMinorYGrid
in interfaceDrawableAxes
-
setX
public void setX(double x) Description copied from interface:CartesianAxes
Sets the drawing location.- Specified by:
setX
in interfaceCartesianAxes
-
setY
public void setY(double y) Description copied from interface:CartesianAxes
Sets the drawing location.- Specified by:
setY
in interfaceCartesianAxes
-
getX
public double getX()Description copied from interface:CartesianAxes
Gets the drawing location.- Specified by:
getX
in interfaceCartesianAxes
- Returns:
- the x location
-
getY
public double getY()Description copied from interface:CartesianAxes
Gets the drawing location.- Specified by:
getY
in interfaceCartesianAxes
- Returns:
- the y location
-