rvl.awt
Class IntPlot

java.lang.Object
  |
  +--java.awt.Component
        |
        +--rvl.awt.Plot
              |
              +--rvl.awt.IntPlot
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class IntPlot
extends Plot
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class rvl.awt.Plot
defaultColor, defaultDotSize, dotColor, dotSize, h0, h1, hMax, hMin, lineColor, mh, mv, needsRescaling, sameScale, scaleColor, scaleFont, swap, title, v0, v1, vMax, vMin, x, xAxisLab, xCustomLab, xMax, xMin, xTick, xTickLab, y, yAxisLab, yCustomLab, yMax, yMin, yTick, yTickLab
 
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, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
IntPlot(double[][] x, double[][] y)
          Constructor for general case.
IntPlot(double[] x, double[] y)
          Constructor for a simple plot of one variable against another.
IntPlot(double[] x, double[][] y)
          Constructor for a multiple plot of several y[]s, all with same x[].
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Add an action listener for this component
 boolean isMoveable()
           
protected  int[] locate(int H, int V, int radius)
          Locate a point near given screen coordinates
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
          If mouse button is pressed, register which point (if any) is to be moved
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void setConstraints(boolean cx, boolean cy)
          Set constraints on directions points may be moved Warning: If both arguments are true, we are saying neither coordinate can be changed; so this has the side effect of calling setMoveable(false).
 void setMoveable(boolean moveable)
           
 void update(java.awt.Graphics g)
          Double-buffers so we don't get flickering when moving points
 
Methods inherited from class rvl.awt.Plot
getMinimumSize, getPreferredSize, getXData, getYData, isBad, minimumSize, paint, preferredSize, rescale, setAxisLabels, setAxisLabels, setData, setData, setData, setData, setData, setData, setDefaultColor, setDefaultDotSize, setDotColor, setDotColor, setDotColor, setDotMode, setDotSize, setDotSize, setDotSize, setLineColor, setLineColor, setLineColor, setLineMode, setSameScale, setScaleColor, setTickMode, setTitle, setTitle, setTranspose, setXData, setXData, setXTicks, setYData, setYData, setYTicks
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntPlot

public IntPlot(double[][] x,
               double[][] y)
Constructor for general case.
See Also:
Plot

IntPlot

public IntPlot(double[] x,
               double[] y)
Constructor for a simple plot of one variable against another.

IntPlot

public IntPlot(double[] x,
               double[][] y)
Constructor for a multiple plot of several y[]s, all with same x[].
Method Detail

setMoveable

public void setMoveable(boolean moveable)
Parameters:
moveable - if true, the user may move points using the mouse

isMoveable

public boolean isMoveable()

setConstraints

public void setConstraints(boolean cx,
                           boolean cy)
Set constraints on directions points may be moved Warning: If both arguments are true, we are saying neither coordinate can be changed; so this has the side effect of calling setMoveable(false).
Parameters:
cx - if true, the x coordinate cannot be changed
cy - if true, the y coordinate cannot be changed
See Also:
setMoveable(boolean)

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Add an action listener for this component

update

public void update(java.awt.Graphics g)
Double-buffers so we don't get flickering when moving points
Overrides:
update in class java.awt.Component

locate

protected int[] locate(int H,
                       int V,
                       int radius)
Locate a point near given screen coordinates
Parameters:
H - Horizontal screen coordinate of point
V - Vertical screen coordinate of point
radius - Specifies how near is near enough.
Returns:
an integer vector of indices {ix,jx,iy,jy} corresponding to the data point (x[jx][ix], y[jy][iy]). The first point for which the screen coordinates are within radius of (x,y) is identified. If there are no such points, a null is returned.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
If mouse button is pressed, register which point (if any) is to be moved
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener