graph
Class G2Dint

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended bygraph.Graph2D
              extended bygraph.G2Dint
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class G2Dint
extends Graph2D

This class is an extension of Graph2D class. It adds interactive selection of the plotting range and can display the mouse position in user coordinates.

Mouse Events

MouseDown
Starts the range selection
MouseDrag
Drag out a rectangular range selection
MouseUp
Replot with modified plotting range.

KeyDown Events

R
Redraw plot with default limits
r
Redraw plot using current limits
m
Pop window to enter manually plot range
c
Toggle pop-up window that displays the mouse position in user coordinates
d
Show coordinates of the closest data point to the cursor
D
Hide data coordinates pop-window
h
This key pressed in Any pop-window at any-time will hide it.

Note: To hide Any pop-window press the key h in the window. This will hide the window at any time. Depending on your windowing system the mouse button might have to be pressed in the popup window to ensure it has the keyboard focus.

Version:
$Revision: 1.9 $, $Date: 1996/07/02 06:01:12 $.
Author:
Leigh Brookshaw
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  Gin cpgin
          Ths popup window for the cursor position command
private  Gin dpgin
          Ths popup window for the data point command
protected  boolean drag
          Set to true when a rectangle is being dragged out by the mouse
private  Range range
          The popup window to manually set the range
protected  boolean userlimits
          User limits.
private  int x0
          Button Down position
private  int x1
          Button Drag position
private  int x1old
           
protected  Axis xaxis
          Attached X Axis which must be registered with this class.
private  int y0
          Button Down position
private  int y1
          Button Drag position
private  int y1old
           
protected  Axis yaxis
          Attached Y Axis which must be registered with this class.
 
Fields inherited from class graph.Graph2D
axis, borderBottom, borderLeft, borderRight, borderTop, clearAll, DataBackground, datarect, dataset, drawgrid, drawzero, frame, framecolor, gridcolor, lastText, load_thread, loadingData, markers, paintAll, square, zerocolor
 
Fields inherited from class java.awt.Canvas
 
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
G2Dint()
           
 
Method Summary
 boolean action(java.awt.Event e, java.lang.Object a)
          Handle the Action Events.
 void attachAxis(Axis a)
          Attach axis to be used for the drag scaling.
 Axis createXAxis()
          Create Xaxis to be used for the drag scaling
 Axis createYAxis()
          Create Yaxis to be used for the drag scaling
protected  double[] getClosestPoint(int ix, int iy)
          Find the closest data point to the cursor
 boolean keyDown(java.awt.Event e, int key)
          Handle the Key Down events.
 boolean mouseDown(java.awt.Event e, int x, int y)
          Handle the Mouse Down events
 boolean mouseDrag(java.awt.Event e, int x, int y)
          Handle the Mouse Drag events
 boolean mouseMove(java.awt.Event e, int x, int y)
          Handle the Mouse Mouve events
 boolean mouseUp(java.awt.Event e, int x, int y)
          Handle the Mouse Up events
 void update(java.awt.Graphics g)
          New update method incorporating mouse dragging.
 
Methods inherited from class graph.Graph2D
attachDataSet, createAxis, detachAxes, detachAxis, detachDataSet, detachDataSets, drawAxis, drawFrame, finishedloading, ForceSquare, getDataRectangle, getMarkers, getXmax, getXmin, getYmax, getYmin, loadDataSet, loadFile, loadmessage, paint, paintBeforeData, paintFirst, paintLast, setDataBackground, setGraphBackground, setMarkers, startedloading
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseEnter, mouseExit, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

drag

protected boolean drag
Set to true when a rectangle is being dragged out by the mouse


userlimits

protected boolean userlimits
User limits. The user has set the limits using the mouse drag option


cpgin

private Gin cpgin
Ths popup window for the cursor position command


dpgin

private Gin dpgin
Ths popup window for the data point command


range

private Range range
The popup window to manually set the range


x0

private int x0
Button Down position


y0

private int y0
Button Down position


x1

private int x1
Button Drag position


y1

private int y1
Button Drag position


x1old

private int x1old

y1old

private int y1old

xaxis

protected Axis xaxis
Attached X Axis which must be registered with this class. This is one of the axes used to find the drag range. If no X axis is registered no mouse drag.


yaxis

protected Axis yaxis
Attached Y Axis which must be registered with this class. This is one of the axes used to find the drag range. If no Y axis is registered no mouse drag.

Constructor Detail

G2Dint

public G2Dint()
Method Detail

createXAxis

public Axis createXAxis()
Create Xaxis to be used for the drag scaling


createYAxis

public Axis createYAxis()
Create Yaxis to be used for the drag scaling


attachAxis

public void attachAxis(Axis a)
Attach axis to be used for the drag scaling. X axes are assumed to have Axis position Axis.BOTTOM or Axis.TOP. Y axes are assumed to have position Axis.LEFT or Axis.RIGHT.

Overrides:
attachAxis in class Graph2D
Parameters:
a - Axis to attach
See Also:
Axis

update

public void update(java.awt.Graphics g)
New update method incorporating mouse dragging.

Overrides:
update in class Graph2D

keyDown

public boolean keyDown(java.awt.Event e,
                       int key)
Handle the Key Down events.

Overrides:
keyDown in class Graph2D

mouseDown

public boolean mouseDown(java.awt.Event e,
                         int x,
                         int y)
Handle the Mouse Down events


mouseUp

public boolean mouseUp(java.awt.Event e,
                       int x,
                       int y)
Handle the Mouse Up events


mouseDrag

public boolean mouseDrag(java.awt.Event e,
                         int x,
                         int y)
Handle the Mouse Drag events


mouseMove

public boolean mouseMove(java.awt.Event e,
                         int x,
                         int y)
Handle the Mouse Mouve events


action

public boolean action(java.awt.Event e,
                      java.lang.Object a)
Handle the Action Events. This handler allows external classes (pop-up windows etc.) to communicate to this class asyncronously.


getClosestPoint

protected double[] getClosestPoint(int ix,
                                   int iy)
Find the closest data point to the cursor