Class GraphCanvas

java.lang.Object
java.awt.Component
java.awt.Canvas
org.nfunk.jepexamples.GraphCanvas
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class GraphCanvas extends Canvas
This class plots a graph using the JEP API.
See Also:
  • Constructor Details

    • GraphCanvas

      public GraphCanvas(String initialExpression, TextField exprField_in)
      Constructor
  • Method Details

    • setExpressionString

      public void setExpressionString(String newString)
      Sets a new string to be used as function
    • paint

      public void paint(Graphics g_in)
      Draws the graph to the Graphics object. If the image buffer has been initialized, and the function has not changed since the last paint, the image stored in the buffer is drawn straight to the Graphics object with drawImage().

      If a image buffer has not yet been initialized (i.e. first time after being started) the buffer is created with createImage().

      If the function has changed since the last paint, the graph is first drawn on the buffer image, then that image is drawn on the Graphics object.

      Overrides:
      paint in class Canvas