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 TypeMethodDescriptionvoid
centerAxes
(DrawingPanel panel) void
draw
(DrawingPanel panel, Graphics g) Draws the axes in the drawing panel.findInteractive
(DrawingPanel panel, int xpix, int ypix) getTitle()
Gets the title.double
getX()
Gets the drawing location.Gets the x axis label.double
getXMax()
Gets the maximum x needed to draw this object.double
getXMin()
Gets the minimum x needed to draw this object.double
getY()
Gets the drawing location.Gets the y axis label.double
getYMax()
Gets the maximum y needed to draw this object.double
getYMin()
Gets the minimum y needed to draw this object.boolean
boolean
Determines if information is available to set min/max values.boolean
isXLog()
Determines if the x axis is logarithmic.boolean
isYLog()
Deteermines if the y axis is logarithmic.void
setEnabled
(boolean _enabled) 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 a title that will be drawn within the drawing panel.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
setXY
(double x, double y) 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.axes.DrawableAxes
getInteriorBackground, resizeFonts, setVisible
Methods 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:
setXLabel
in 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:
setYLabel
in 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:
setTitle
in interfaceDrawableAxes
- Overrides:
setTitle
in classAbstractAxes
- Parameters:
s
- the titlefont_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
-
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
-
centerAxes
-
setEnabled
public void setEnabled(boolean _enabled) - Specified by:
setEnabled
in interfaceInteractive
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceInteractive
-
setXY
public void setXY(double x, double y) - Specified by:
setXY
in interfaceInteractive
-
setX
public void setX(double x) Description copied from interface:CartesianAxes
Sets the drawing location.- Specified by:
setX
in interfaceCartesianAxes
- Specified by:
setX
in interfaceInteractive
-
setY
public void setY(double y) Description copied from interface:CartesianAxes
Sets the drawing location.- Specified by:
setY
in interfaceCartesianAxes
- Specified by:
setY
in interfaceInteractive
-
getX
public double getX()Description copied from interface:CartesianAxes
Gets the drawing location.- Specified by:
getX
in interfaceCartesianAxes
- Specified by:
getX
in interfaceInteractive
- Returns:
- the x location
-
getY
public double getY()Description copied from interface:CartesianAxes
Gets the drawing location.- Specified by:
getY
in interfaceCartesianAxes
- Specified by:
getY
in interfaceInteractive
- Returns:
- the y location
-
getXMin
public double getXMin()Gets the minimum x needed to draw this object.- Specified by:
getXMin
in interfaceMeasurable
- Returns:
- minimum
-
getXMax
public double getXMax()Gets the maximum x needed to draw this object.- Specified by:
getXMax
in interfaceMeasurable
- Returns:
- maximum
-
getYMin
public double getYMin()Gets the minimum y needed to draw this object.- Specified by:
getYMin
in interfaceMeasurable
- Returns:
- minimum
-
getYMax
public double getYMax()Gets the maximum y needed to draw this object.- Specified by:
getYMax
in 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:
isMeasured
in interfaceMeasurable
- Returns:
- true if min/max values are valid
-
findInteractive
- Specified by:
findInteractive
in interfaceInteractive
-