org.PingOO.DLAI.lib.graph
Class G2Dint

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--org.PingOO.DLAI.lib.graph.Graph2D
                    |
                    +--org.PingOO.DLAI.lib.graph.G2Dint
Direct Known Subclasses:
Contour

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 (http://www.sci.usq.edu.au/staff/leighb/graph/) (leighb@usq.edu.au)
See Also:
Serialized Form

Inner Class Summary
protected  class G2Dint.G2DintActionListener
           
protected  class G2Dint.G2DintKeyListener
           
protected  class G2Dint.G2DintMouseListener
           
protected  class G2Dint.G2DintMouseMotionListener
           
protected  class G2Dint.Gin
          Popup a window to output data after a Graphics Input command the window contains the following : X value, Y value
protected  class G2Dint.Range
          A popup window for altering the range of the plot
 
Inner classes inherited from class org.PingOO.DLAI.lib.graph.Graph2D
Graph2D.Graph2DKeyListener, Graph2D.LoadMessage
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
private  G2Dint.Gin cpgin
          This popup window for the cursor position command.
protected  java.awt.event.ActionListener defaultActionListener
           
protected  java.awt.event.MouseListener defaultMouseListener
           
protected  java.awt.event.MouseMotionListener defaultMouseMotionListener
           
private  G2Dint.Gin dpgin
          This popup window for the data point command.
protected  boolean drag
          Sets to true when a rectangle is being dragged out by the mouse.
private  G2Dint.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
          Previous Button Drag position
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
          Previous Button Drag position
protected  Axis yaxis
          Attached Y Axis which must be registered with this class.
 
Fields inherited from class org.PingOO.DLAI.lib.graph.Graph2D
axis, borderBottom, borderLeft, borderRight, borderTop, clearAll, DataBackground, datarect, dataset, DefaultBackground, defaultKeyListener, drawgrid, drawzero, frame, framecolor, gridcolor, lastText, load_thread, loadingData, markers, paintAll, square, zerocolor
 
Fields inherited from class java.awt.Canvas
base, graphicsConfig, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
G2Dint()
           
 
Method Summary
 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
 void update(java.awt.Graphics g)
          New update method incorporating mouse dragging.
 
Methods inherited from class org.PingOO.DLAI.lib.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, constructComponentName, postsOldMouseEvents
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, 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, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

drag

protected boolean drag
Sets 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 G2Dint.Gin cpgin
This popup window for the cursor position command.

dpgin

private G2Dint.Gin dpgin
This popup window for the data point command.

range

private G2Dint.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
Previous Button Drag position

y1old

private int y1old
Previous Button Drag position

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.

defaultMouseListener

protected java.awt.event.MouseListener defaultMouseListener

defaultMouseMotionListener

protected java.awt.event.MouseMotionListener defaultMouseMotionListener

defaultActionListener

protected java.awt.event.ActionListener defaultActionListener
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.
Parameters:
a - Axis to attach
Overrides:
attachAxis in class Graph2D
See Also:
Axis

update

public void update(java.awt.Graphics g)
New update method incorporating mouse dragging.
Overrides:
update in class Graph2D

getClosestPoint

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