Class CartesianType3

java.lang.Object
org.opensourcephysics.display.axes.AbstractAxes
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 Details

    • 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 Details

    • setXLabel

      public void setXLabel(String s, 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(String s, 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(String s, 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 String getXLabel()
      Gets the x axis label.
      Specified by:
      getXLabel in interface DrawableAxes
      Returns:
      String
    • getYLabel

      public String getYLabel()
      Gets the y axis label.
      Specified by:
      getYLabel in interface DrawableAxes
      Returns:
      String
    • getTitle

      public 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, Graphics g)
      Draws the axes in the drawing panel.
      Specified by:
      draw in interface Drawable
      Parameters:
      panel -
      g -
    • setInteriorBackground

      public void setInteriorBackground(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