edu.uci.ics.jung.visualization.control
Class ViewTranslatingGraphMousePlugin

java.lang.Object
  extended by edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
      extended by edu.uci.ics.jung.visualization.control.ViewTranslatingGraphMousePlugin
All Implemented Interfaces:
GraphMousePlugin, MouseListener, MouseMotionListener, EventListener

public class ViewTranslatingGraphMousePlugin
extends AbstractGraphMousePlugin
implements MouseListener, MouseMotionListener

ViewTranslatingGraphMousePlugin uses a MouseButtonOne press and drag gesture to translate the graph display in the x and y direction by changing the AffineTransform applied to the Graphics2D. The default MouseButtonOne modifier can be overridden to cause a different mouse gesture to translate the display.

Author:
Tom Nelson

Field Summary
 
Fields inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
cursor, down, modifiers
 
Constructor Summary
ViewTranslatingGraphMousePlugin()
           
ViewTranslatingGraphMousePlugin(int modifiers)
          create an instance with passed modifer value
 
Method Summary
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
          chack the modifiers.
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
          Check the event modifiers.
 void mouseReleased(MouseEvent e)
          unset the 'down' point and change the cursoe back to the system default cursor
 
Methods inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
checkModifiers, getCursor, getModifiers, setCursor, setModifiers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewTranslatingGraphMousePlugin

public ViewTranslatingGraphMousePlugin()

ViewTranslatingGraphMousePlugin

public ViewTranslatingGraphMousePlugin(int modifiers)
create an instance with passed modifer value

Parameters:
modifiers - the mouse event modifier to activate this function
Method Detail

mousePressed

public void mousePressed(MouseEvent e)
Check the event modifiers. Set the 'down' point for later use. If this event satisfies the modifiers, change the cursor to the system 'move cursor'

Specified by:
mousePressed in interface MouseListener
Parameters:
e - the event

mouseReleased

public void mouseReleased(MouseEvent e)
unset the 'down' point and change the cursoe back to the system default cursor

Specified by:
mouseReleased in interface MouseListener

mouseDragged

public void mouseDragged(MouseEvent e)
chack the modifiers. If accepted, translate the graph according to the dragging of the mouse pointer

Specified by:
mouseDragged in interface MouseMotionListener
Parameters:
e - the event

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener


Copyright © 2009. All Rights Reserved.