Class PlotPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class PlotPanel extends JPanel
Canvas for mathematical plots.

For both 2D and 3D plot, the user can zoom in/out by mouse wheel. For 2D plot, the user can shift the coordinates by moving mouse after double click. The user can also select an area by mouse for detailed view. For 3D plot, the user can rotate the view by dragging mouse.

See Also:
  • Constructor Details

    • PlotPanel

      public PlotPanel(Canvas canvas)
      Constructor
  • Method Details

    • getToolbar

      public JComponent getToolbar()
      Returns a tool bar to control the plot.
      Returns:
      a tool bar to control the plot.
    • save

      public void save() throws IOException
      Shows a file chooser and exports the plot to the selected image file.
      Throws:
      IOException - if an error occurs during writing.
    • save

      public void save(File file) throws IOException
      Exports the plot to an image file.
      Parameters:
      file - the destination file.
      Throws:
      IOException - if an error occurs during writing.
    • print

      public void print()
      Prints the plot.
    • zoom

      public void zoom(boolean inout)
      Zooms in/out the plot.
      Parameters:
      inout - true if zoom in. Otherwise, zoom out.
    • reset

      public void reset()
      Resets the plot.
    • window

      Shows the plot in a window.
      Returns:
      a new JFrame that contains the plot.
      Throws:
      InterruptedException
      InvocationTargetException