Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.visualization
Class SimpleGraphMouse

    java.lang.Object
      java.awt.event.MouseAdapter
          edu.uci.ics.jung.visualization.SimpleGraphMouse

All Implemented Interfaces:
  EventListener, MouseListener, MouseMotionListener, MouseWheelListener, VisualizationViewer.GraphMouse

public class SimpleGraphMouse
extends MouseAdapter
implements VisualizationViewer.GraphMouse

SimpleGraphMouse is the original GraphMouse class that was nested in VisualizationViewer and installed as a listener for mouse events and mouse motion events. Users can restore previous capability by creating an instance of this class and using VisualizationViewer.setGraphMouse() to re-install it. Changes in this code from the nested version are mainly those necessary to move it outside the VisualizationViewer class, and to properly handle the transform values of the VisualizationViewer (the zoom and pan)

Field Summary
`protected float` | `offsetx` how far the mouse point x is from the vertex center x
`protected float` | `offsety` how far the mouse point y is from the vertex center y
`protected Vertex` | `vertexToDrag` the vertex to drag with a mouseDragged operation
`protected VisualizationViewer` | `vv` the VisualizationViewer who's mouse events call these methods.

Constructor Summary
`SimpleGraphMouse(VisualizationViewer vv)` create an instance for the passed VisualizationViewer

Method Summary
`void` | `mouseDragged(MouseEvent e)` if a Vertex was picked in the mousePressed method, use the layout class to force that Vertex to move, following the motion of the mouse.
`void` | `mouseMoved(MouseEvent e)` no-op here
`void` | `mousePressed(MouseEvent e)` Uses the layout class to attempt to pick a vertex in the graph.
`void` | `mouseReleased(MouseEvent e)` clean up after the pick of a Vertex or Edge
`void` | `mouseWheelMoved(MouseWheelEvent e)` no-op here

Methods inherited from class java.awt.event.MouseAdapter
`mouseClicked, mouseEntered, mouseExited`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.awt.event.MouseListener
`mouseClicked, mouseEntered, mouseExited`

Field Detail

### vv

    protected VisualizationViewer vv

  the VisualizationViewer who's mouse events call these methods.

### offsetx

    protected float offsetx

  how far the mouse point x is from the vertex center x

### offsety

    protected float offsety

  how far the mouse point y is from the vertex center y

### vertexToDrag

    protected Vertex vertexToDrag

  the vertex to drag with a mouseDragged operation

Constructor Detail

### SimpleGraphMouse

    public SimpleGraphMouse(VisualizationViewer vv)

  create an instance for the passed VisualizationViewer

Parameters:
  `vv` -

Method Detail

### mousePressed

    public void mousePressed(MouseEvent e)

  Uses the layout class to attempt to pick a vertex in the graph.

  Specified by:
    `mousePressed` in interface `MouseListener`

### mouseReleased

    public void mouseReleased(MouseEvent e)

  clean up after the pick of a Vertex or Edge

  Specified by:
    `mouseReleased` in interface `MouseListener`

### mouseDragged

    public void mouseDragged(MouseEvent e)

  if a Vertex was picked in the mousePressed method, use the layout class to force that Vertex to move, following the motion of the mouse.

  Specified by:
    `mouseDragged` in interface `MouseMotionListener`

### mouseMoved

    public void mouseMoved(MouseEvent e)

  no-op here

  Specified by:
    `mouseMoved` in interface `MouseMotionListener`

### mouseWheelMoved

    public void mouseWheelMoved(MouseWheelEvent e)

  no-op here

  Specified by:
    `mouseWheelMoved` in interface `MouseWheelListener`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD