ptolemy.plot
Class PlotFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--ptolemy.plot.PlotFrame
Direct Known Subclasses:
PlotApplication, PlotMLFrame

public class PlotFrame
extends java.awt.Frame

PlotFrame is a versatile two-dimensional data plotter that runs as part of an application, but in its own window. It can read files compatible with the old Ptolemy plot file format (currently only ASCII). It is extended with the capability to read PlotML files in PlotMLFrame. An application can also interact directly with the contained Plot object, which is visible as a public member, by invoking its methods.

An application that uses this class should set up the handling of window-closing events. Presumably, the application will exit when all windows have been closed. This is done with code something like:

plotFrameInstance.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
// Handle the event
}
});

PlotFrame contains an instance of PlotBox. PlotBox is the base class for classes with drawing capability, e.g. Plot, LogicAnalyzer. If not specified in the constructor, the default is to contain a Plot object. This field is set once in the constructor and immutable afterwards.

Version:
$Id: PlotFrame.java,v 1.34 1999/08/19 15:32:27 cxh Exp $
Author:
Christopher Hylands and Edward A. Lee
See Also:
Plot, PlotBox, Serialized Form

Field Summary
protected  java.lang.String _directory
           
protected  java.awt.Menu _editMenu
           
protected  java.awt.Menu _fileMenu
           
protected  java.lang.String _filename
           
protected  java.awt.MenuBar _menubar
           
protected  java.awt.Menu _specialMenu
           
 PlotBox plot
           
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
PlotFrame()
          Construct a plot frame with a default title and by default contains an instance of Plot.
PlotFrame(java.lang.String title)
          Construct a plot frame with the specified title and by default contains an instance of Plot.
PlotFrame(java.lang.String title, PlotBox plotArg)
          Construct a plot frame with the specified title and the specified instance of PlotBox.
 
Method Summary
protected  void _about()
           
protected  void _close()
          Close the window.
protected  void _editFormat()
          Interactively edit the file format.
protected  void _export()
          Query the user for a filename and export the plot to that file.
protected  void _help()
          Display more detailed information than given by _about().
protected  void _open()
          Open a new file and plot its data.
protected  void _print()
          Print the plot.
protected  void _read(java.net.URL base, java.io.InputStream in)
          Read the specified stream.
protected  void _save()
          Save the plot to the current file, determined by the _directory and _filename protected variables.
protected  void _saveAs()
          Query the user for a filename and save the plot to that file.
 void samplePlot()
          Create a sample plot.
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, paramString, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

plot

public PlotBox plot

_menubar

protected java.awt.MenuBar _menubar

_editMenu

protected java.awt.Menu _editMenu

_fileMenu

protected java.awt.Menu _fileMenu

_specialMenu

protected java.awt.Menu _specialMenu

_directory

protected java.lang.String _directory

_filename

protected java.lang.String _filename
Constructor Detail

PlotFrame

public PlotFrame()
Construct a plot frame with a default title and by default contains an instance of Plot. After constructing this, it is necessary to call setVisible(true) to make the plot appear.

PlotFrame

public PlotFrame(java.lang.String title)
Construct a plot frame with the specified title and by default contains an instance of Plot. After constructing this, it is necessary to call setVisible(true) to make the plot appear.
Parameters:
title - The title to put on the window.

PlotFrame

public PlotFrame(java.lang.String title,
                 PlotBox plotArg)
Construct a plot frame with the specified title and the specified instance of PlotBox. After constructing this, it is necessary to call setVisible(true) to make the plot appear.
Parameters:
title - The title to put on the window.
plotArg - the plot object to put in the frame, or null to create an instance of Plot.
Method Detail

samplePlot

public void samplePlot()
Create a sample plot.

_about

protected void _about()

_close

protected void _close()
Close the window.

_editFormat

protected void _editFormat()
Interactively edit the file format.

_export

protected void _export()
Query the user for a filename and export the plot to that file. Currently, the only supported format is EPS.

_help

protected void _help()
Display more detailed information than given by _about().

_open

protected void _open()
Open a new file and plot its data.

_print

protected void _print()
Print the plot.

_read

protected void _read(java.net.URL base,
                     java.io.InputStream in)
              throws java.io.IOException
Read the specified stream. Derived classes may override this to support other file formats.
Parameters:
base - The base for relative file references, or null if there are not relative file references.
in - The input stream.
Throws:
java.io.IOException - If the stream cannot be read.

_save

protected void _save()
Save the plot to the current file, determined by the _directory and _filename protected variables.

_saveAs

protected void _saveAs()
Query the user for a filename and save the plot to that file.