org.opensourcephysics.display.axes
Class CartesianType3

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

public class CartesianType3
extends AbstractAxes
implements CartesianAxes, Interactive

CartesianType3 draws draggable X and Y axes in the interior of a plotting panel.

Author:
W. Christian

Constructor Summary
CartesianType3(PlottingPanel panel)
          Constructs the XYAxes inside the drawing panel.
 
Method Summary
 void centerAxes(DrawingPanel panel)
           
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the axes in the drawing panel.
 Interactive findInteractive(DrawingPanel panel, int xpix, int ypix)
           
 java.lang.String getTitle()
          Gets the title.
 double getX()
          Gets the drawing location.
 java.lang.String getXLabel()
          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.
 java.lang.String getYLabel()
          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 isEnabled()
           
 boolean isMeasured()
          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(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 a title that will be drawn within the drawing panel.
 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 setXY(double x, double y)
           
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.axes.DrawableAxes
getInteriorBackground, resizeFonts, setVisible
 

Constructor Detail

CartesianType3

public CartesianType3(PlottingPanel panel)
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 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 title
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 title
font_name - an optional font name

setTitle

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

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

centerAxes

public void centerAxes(DrawingPanel panel)

setEnabled

public void setEnabled(boolean _enabled)
Specified by:
setEnabled in interface Interactive

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface Interactive

setXY

public void setXY(double x,
                  double y)
Specified by:
setXY in interface Interactive

setX

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

Specified by:
setX in interface CartesianAxes
Specified by:
setX in interface Interactive

setY

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

Specified by:
setY in interface CartesianAxes
Specified by:
setY in interface Interactive

getX

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

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

getY

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

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

getXMin

public double getXMin()
Gets the minimum x needed to draw this object.

Specified by:
getXMin in interface Measurable
Returns:
minimum

getXMax

public double getXMax()
Gets the maximum x needed to draw this object.

Specified by:
getXMax in interface Measurable
Returns:
maximum

getYMin

public double getYMin()
Gets the minimum y needed to draw this object.

Specified by:
getYMin in interface Measurable
Returns:
minimum

getYMax

public double getYMax()
Gets the maximum y needed to draw this object.

Specified by:
getYMax in interface Measurable
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 interface Measurable
Returns:
true if min/max values are valid

findInteractive

public Interactive findInteractive(DrawingPanel panel,
                                   int xpix,
                                   int ypix)
Specified by:
findInteractive in interface Interactive