Class FunctionCanvas

All Implemented Interfaces:
ComponentListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class FunctionCanvas extends AbstractCanvas
This class plots a graph using the Jep API.
See Also:
  • Field Details

    • jep

      protected final Jep jep
      Math parser
    • expression

      protected Node expression
      Expression to evaluate
    • x

      protected final Variable x
      "x" variable
  • Constructor Details

    • FunctionCanvas

      public FunctionCanvas(Jep jep, Variable x)
      Constructor
  • Method Details

    • getExpression

      public Node getExpression()
    • setExpression

      public void setExpression(Node expression)
    • paintCurve

      protected void paintCurve(Graphics g)
      Paints the graph of the function. A null argument cause the values to be dumped to stdout.
      Specified by:
      paintCurve in class AbstractCanvas
    • rescaled

      public void rescaled()
      Description copied from class: AbstractCanvas
      Called when scale or offset changed Default action is to call repaint
      Overrides:
      rescaled in class AbstractCanvas
    • dump

      public void dump()
      Dump the coordinates on the standard output
      Specified by:
      dump in class AbstractCanvas
    • getNumPts

      protected long getNumPts()
      Description copied from class: AbstractCanvas
      The number of points which are calculated
      Specified by:
      getNumPts in class AbstractCanvas
      Returns:
      the number of points