ij.gui
Class PlotWindow

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by ij.gui.ImageWindow
                      extended by ij.gui.PlotWindow
All Implemented Interfaces:
java.awt.datatransfer.ClipboardOwner, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.MouseWheelListener, java.awt.event.WindowListener, java.awt.event.WindowStateListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class PlotWindow
extends ImageWindow
implements java.awt.event.ActionListener, java.awt.datatransfer.ClipboardOwner

This class is an extended ImageWindow that displays line graphs.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static boolean autoClose
          Automatically close window after saving values.
static int BOX
          Display points using an box-shaped mark.
static int CIRCLE
          Display points using a circle 5 pixels in diameter.
static int CROSS
          Display points using an cross-shaped mark.
static boolean interpolate
          Interpolate line profiles.
static int LINE
          Connect points with solid lines.
static boolean listValues
          Display the XY coordinates in a separate window.
static boolean noGridLines
          Add grid lines to plots
static int plotHeight
          The height of the plot in pixels.
static int plotWidth
          The width of the plot in pixels.
static boolean saveXValues
          Save x-values only.
static int TRIANGLE
          Display points using an tiangular mark.
static int X
          Display points using an X-shaped mark.
 
Fields inherited from class ij.gui.ImageWindow
closed, ic, ij, imp, MIN_HEIGHT, MIN_WIDTH, running, running2
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, 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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, PROPERTIES, SOMEBITS
 
Constructor Summary
PlotWindow(java.lang.String title, java.lang.String xLabel, java.lang.String yLabel, double[] xValues, double[] yValues)
          This version of the constructor excepts double arrays.
PlotWindow(java.lang.String title, java.lang.String xLabel, java.lang.String yLabel, float[] xValues, float[] yValues)
          Construct a new PlotWindow.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addErrorBars(float[] errorBars)
          Adds error bars to the plot.
 void addLabel(double x, double y, java.lang.String label)
          Draws a label.
 void addPoints(double[] x, double[] y, int shape)
          Adds a set of points to the plot using double arrays.
 void addPoints(float[] x, float[] y, int shape)
          Adds a set of points to the plot or adds a curve if shape is set to LINE.
 void changeFont(java.awt.Font font)
          Changes the font.
 void draw()
          Displays the plot.
 void drawPlot(Plot plot)
          Draws a new plot in this window.
 float[] getXValues()
           
 float[] getYValues()
           
 void lostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable contents)
           
 void mouseMoved(int x, int y)
          Updates the graph X and Y values when the mouse is moved.
static void savePreferences(java.util.Properties prefs)
          Called once when ImageJ quits.
 void setColor(java.awt.Color c)
          Changes the drawing color.
 void setLimits(double xMin, double xMax, double yMin, double yMax)
          Sets the x-axis and y-axis range.
 void setLineWidth(int lineWidth)
          Changes the line width.
 
Methods inherited from class ij.gui.ImageWindow
centerNextImage, close, copy, drawInfo, focusGained, focusLost, getCanvas, getImagePlus, getInitialMagnification, getInsets, getMaximumBounds, isClosed, maximize, minimize, mouseWheelMoved, paint, paste, toString, updateImage, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened, windowStateChanged
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

CIRCLE

public static final int CIRCLE
Display points using a circle 5 pixels in diameter.

See Also:
Constant Field Values

X

public static final int X
Display points using an X-shaped mark.

See Also:
Constant Field Values

BOX

public static final int BOX
Display points using an box-shaped mark.

See Also:
Constant Field Values

TRIANGLE

public static final int TRIANGLE
Display points using an tiangular mark.

See Also:
Constant Field Values

CROSS

public static final int CROSS
Display points using an cross-shaped mark.

See Also:
Constant Field Values

LINE

public static final int LINE
Connect points with solid lines.

See Also:
Constant Field Values

saveXValues

public static boolean saveXValues
Save x-values only. To set, use Edit/Options/ Profile Plot Options.


autoClose

public static boolean autoClose
Automatically close window after saving values. To set, use Edit/Options/Profile Plot Options.


plotWidth

public static int plotWidth
The width of the plot in pixels.


plotHeight

public static int plotHeight
The height of the plot in pixels.


listValues

public static boolean listValues
Display the XY coordinates in a separate window. To set, use Edit/Options/Profile Plot Options.


interpolate

public static boolean interpolate
Interpolate line profiles. To set, use Edit/Options/Profile Plot Options.


noGridLines

public static boolean noGridLines
Add grid lines to plots

Constructor Detail

PlotWindow

public PlotWindow(java.lang.String title,
                  java.lang.String xLabel,
                  java.lang.String yLabel,
                  float[] xValues,
                  float[] yValues)
Construct a new PlotWindow.

Parameters:
title - the window title
xLabel - the x-axis label
yLabel - the y-axis label
xValues - the x-coodinates
yValues - the y-coodinates

PlotWindow

public PlotWindow(java.lang.String title,
                  java.lang.String xLabel,
                  java.lang.String yLabel,
                  double[] xValues,
                  double[] yValues)
This version of the constructor excepts double arrays.

Method Detail

setLimits

public void setLimits(double xMin,
                      double xMax,
                      double yMin,
                      double yMax)
Sets the x-axis and y-axis range.


addPoints

public void addPoints(float[] x,
                      float[] y,
                      int shape)
Adds a set of points to the plot or adds a curve if shape is set to LINE.

Parameters:
x - the x-coodinates
y - the y-coodinates
shape - CIRCLE, X, BOX, TRIANGLE, CROSS or LINE

addPoints

public void addPoints(double[] x,
                      double[] y,
                      int shape)
Adds a set of points to the plot using double arrays. Must be called before the plot is displayed.


addErrorBars

public void addErrorBars(float[] errorBars)
Adds error bars to the plot.


addLabel

public void addLabel(double x,
                     double y,
                     java.lang.String label)
Draws a label.


setColor

public void setColor(java.awt.Color c)
Changes the drawing color. The frame and labels are always drawn in black.


setLineWidth

public void setLineWidth(int lineWidth)
Changes the line width.


changeFont

public void changeFont(java.awt.Font font)
Changes the font.


draw

public void draw()
Displays the plot.


mouseMoved

public void mouseMoved(int x,
                       int y)
Updates the graph X and Y values when the mouse is moved. Overrides mouseMoved() in ImageWindow.

Overrides:
mouseMoved in class ImageWindow
See Also:
ImageWindow.mouseMoved(int, int)

lostOwnership

public void lostOwnership(java.awt.datatransfer.Clipboard clipboard,
                          java.awt.datatransfer.Transferable contents)
Specified by:
lostOwnership in interface java.awt.datatransfer.ClipboardOwner

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

getXValues

public float[] getXValues()

getYValues

public float[] getYValues()

drawPlot

public void drawPlot(Plot plot)
Draws a new plot in this window.


savePreferences

public static void savePreferences(java.util.Properties prefs)
Called once when ImageJ quits.