org.opensourcephysics.display.axes
Class CartesianType2

java.lang.Object
  extended by org.opensourcephysics.display.axes.AbstractAxes
      extended by org.opensourcephysics.display.axes.CartesianType2
All Implemented Interfaces:
CartesianAxes, DrawableAxes, Drawable

public class CartesianType2
extends AbstractAxes
implements CartesianAxes


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
CartesianType2(PlottingPanel panel)
          CartesianType2 draws axes in the drawing panel's gutter.
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the axes in the drawing panel.
 java.lang.String getTitle()
          Gets the title.
 double getX()
          Gets the drawing location.
 java.lang.String getXLabel()
          Gets the x axis label.
 double getY()
          Gets the drawing location.
 java.lang.String getYLabel()
          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(java.awt.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 setTitle(java.lang.String s, java.lang.String font_name)
          Set the title.
 void setX(double x)
          Sets the drawing location.
 void setXLabel(java.lang.String s, java.lang.String font_name)
          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 setYLabel(java.lang.String s, java.lang.String font_name)
          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
 

Constructor Detail

CartesianType2

public CartesianType2(PlottingPanel panel)
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 Detail

setXLabel

public void setXLabel(java.lang.String s,
                      java.lang.String font_name)
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 interface DrawableAxes
Parameters:
s - the label
font_name - an optional font name

setYLabel

public void setYLabel(java.lang.String s,
                      java.lang.String font_name)
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 interface DrawableAxes
Parameters:
s - the label
font_name - an optional font name

getXLabel

public java.lang.String getXLabel()
Gets the x axis label.

Specified by:
getXLabel in interface DrawableAxes
Returns:
String

getYLabel

public java.lang.String getYLabel()
Gets the y axis label.

Specified by:
getYLabel in interface DrawableAxes
Returns:
String

getTitle

public java.lang.String getTitle()
Gets the title.

Specified by:
getTitle in interface DrawableAxes
Overrides:
getTitle in class AbstractAxes
Returns:
String

setTitle

public void setTitle(java.lang.String s,
                     java.lang.String font_name)
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 interface DrawableAxes
Overrides:
setTitle in class AbstractAxes
Parameters:
s - the label
font_name - an optional font name

setXLog

public void setXLog(boolean isLog)
Sets the x axis to linear or logarithmic.

Specified by:
setXLog in interface CartesianAxes
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 interface CartesianAxes
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 interface CartesianAxes
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 interface CartesianAxes
Returns:
true if logarithmic; false otherwise

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the axes in the drawing panel.

Specified by:
draw in interface Drawable
Parameters:
panel -
g -

setInteriorBackground

public void setInteriorBackground(java.awt.Color color)
Sets the interior background color.

Specified by:
setInteriorBackground in interface DrawableAxes
Overrides:
setInteriorBackground in class AbstractAxes
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 interface DrawableAxes

setShowMinorXGrid

public void setShowMinorXGrid(boolean showGrid)
Shows a grid line for every x axis minor tickmark.

Specified by:
setShowMinorXGrid in interface DrawableAxes

setShowMajorYGrid

public void setShowMajorYGrid(boolean showGrid)
Shows a grid line for every y axis major tickmark.

Specified by:
setShowMajorYGrid in interface DrawableAxes

setShowMinorYGrid

public void setShowMinorYGrid(boolean showGrid)
Shows a grid line for every y axis minor tickmark.

Specified by:
setShowMinorYGrid in interface DrawableAxes

setX

public void setX(double x)
Description copied from interface: CartesianAxes
Sets the drawing location.

Specified by:
setX in interface CartesianAxes

setY

public void setY(double y)
Description copied from interface: CartesianAxes
Sets the drawing location.

Specified by:
setY in interface CartesianAxes

getX

public double getX()
Description copied from interface: CartesianAxes
Gets the drawing location.

Specified by:
getX in interface CartesianAxes
Returns:
the x location

getY

public double getY()
Description copied from interface: CartesianAxes
Gets the drawing location.

Specified by:
getY in interface CartesianAxes
Returns:
the y location