org.tigris.gef.base
Class ModeDragScroll

java.lang.Object
  extended by org.tigris.gef.base.ModeImpl
      extended by org.tigris.gef.base.FigModifyingModeImpl
          extended by org.tigris.gef.base.ModeDragScroll
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.util.EventListener, FigModifyingMode, Mode

public class ModeDragScroll
extends FigModifyingModeImpl
implements java.awt.event.ActionListener

A Mode that allows the user to scroll the Editor by clicking and dragging with the middle mouse button.

Author:
Sean Chen, schen@webex.net
See Also:
Mode, Editor, Serialized Form

Field Summary
 
Fields inherited from class org.tigris.gef.base.FigModifyingModeImpl
editor
 
Fields inherited from class org.tigris.gef.base.ModeImpl
_args
 
Constructor Summary
ModeDragScroll()
          Construct a new ModeDragScroll instance.
ModeDragScroll(Editor editor)
          Construct a new ModeDragScroll with the given parent.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Interface ActionListener: Simulate mouse dragging
 boolean canExit()
          Always false since this mode can never be exited.
 java.lang.String instructions()
          Instructions for the user.
 void mouseDragged(java.awt.event.MouseEvent me)
          If mouse is outside the component, begins autoscrolling or speeds it up.
 void mousePressed(java.awt.event.MouseEvent me)
          Grabs component to begin scrolling.
 void mouseReleased(java.awt.event.MouseEvent me)
          Stops scrolling, clears all references
 
Methods inherited from class org.tigris.gef.base.FigModifyingModeImpl
done, getEditor, getInitialCursor, isFigEnclosedIn, paint, print, setCursor, setEditor
 
Methods inherited from class org.tigris.gef.base.ModeImpl
getArg, getArgs, init, keyPressed, keyReleased, keyTyped, leave, mouseClicked, mouseEntered, mouseExited, mouseMoved, setArg, setArgs, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tigris.gef.base.Mode
getArg, getArgs, init, setArg, setArgs, start
 

Constructor Detail

ModeDragScroll

public ModeDragScroll(Editor editor)
Construct a new ModeDragScroll with the given parent.

Parameters:
editor - The Editor this Mode will drag

ModeDragScroll

public ModeDragScroll()
Construct a new ModeDragScroll instance. Its parent must be set before this instance can be used.

Method Detail

canExit

public boolean canExit()
Always false since this mode can never be exited.

Specified by:
canExit in interface Mode
Overrides:
canExit in class ModeImpl
See Also:
ModeManager

instructions

public java.lang.String instructions()
Instructions for the user.

Specified by:
instructions in interface FigModifyingMode
Overrides:
instructions in class FigModifyingModeImpl

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Grabs component to begin scrolling. Will turn cursor into a hand.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class ModeImpl
Parameters:
me -

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
If mouse is outside the component, begins autoscrolling or speeds it up. Otherwise will just scroll.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class ModeImpl
Parameters:
me -

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
Stops scrolling, clears all references

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class ModeImpl
Parameters:
me -

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Interface ActionListener: Simulate mouse dragging

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e -