Class ViewTranslatingGraphMousePlugin
- java.lang.Object
-
- org.jungrapht.visualization.control.AbstractGraphMousePlugin
-
- org.jungrapht.visualization.control.ViewTranslatingGraphMousePlugin
-
- All Implemented Interfaces:
MouseListener,MouseMotionListener,EventListener,GraphMousePlugin
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jungrapht.visualization.control.AbstractGraphMousePlugin
AbstractGraphMousePlugin.Selecting
-
-
Field Summary
Fields Modifier and Type Field Description protected inttranslatingMask-
Fields inherited from class org.jungrapht.visualization.control.AbstractGraphMousePlugin
cursor, down, modifiers
-
-
Constructor Summary
Constructors Constructor Description ViewTranslatingGraphMousePlugin()ViewTranslatingGraphMousePlugin(int translatingMask)create an instance with passed modifer value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidmouseClicked(MouseEvent e)voidmouseDragged(MouseEvent e)chack the modifiers.voidmouseEntered(MouseEvent e)voidmouseExited(MouseEvent e)voidmouseMoved(MouseEvent e)voidmousePressed(MouseEvent e)Check the event modifiers.voidmouseReleased(MouseEvent e)unset the 'down' point and change the cursor back to the system default cursor-
Methods inherited from class org.jungrapht.visualization.control.AbstractGraphMousePlugin
checkModifiers, getCursor, getModifiersEx, setCursor, setModifiers
-
-
-
-
Constructor Detail
-
ViewTranslatingGraphMousePlugin
public ViewTranslatingGraphMousePlugin()
-
ViewTranslatingGraphMousePlugin
public ViewTranslatingGraphMousePlugin(int translatingMask)
create an instance with passed modifer value- Parameters:
translatingMask- 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:
mousePressedin interfaceMouseListener- Parameters:
e- the event
-
mouseReleased
public void mouseReleased(MouseEvent e)
unset the 'down' point and change the cursor back to the system default cursor- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseDragged
public void mouseDragged(MouseEvent e)
chack the modifiers. If accepted, translate the graph according to the dragging of the mouse pointer- Specified by:
mouseDraggedin interfaceMouseMotionListener- Parameters:
e- the event
-
mouseClicked
public void mouseClicked(MouseEvent e)
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
public void mouseExited(MouseEvent e)
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseMoved
public void mouseMoved(MouseEvent e)
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
-