@SuppressWarnings("unchecked") public void mousePressed(MouseEvent e){
  if (e.getModifiers() == modifiers) {
    VisualizationViewer<V,E> vv=(VisualizationViewer<V,E>)e.getSource();
    GraphElementAccessor<V,E> pickSupport=vv.getPickSupport();
    PickedState<V> pickedVertexState=vv.getPickedVertexState();
    Layout<V,E> layout=vv.getGraphLayout();
    if (pickSupport != null && pickedVertexState != null) {
      Point2D p=e.getPoint();
      vertex=pickSupport.getVertex(layout,p.getX(),p.getY());
      if (vertex != null) {
        if (pickedVertexState.isPicked(vertex) == false) {
          pickedVertexState.clear();
          pickedVertexState.pick(vertex,true);
        }
      }
    }
    e.consume();
  }
}

@ SuppressWarnings ( "unchecked" ) public void mousePressed ( MouseEvent e ) { if ( e . getModifiers ( ) == modifiers ) { VisualizationViewer < V , E > vv = ( VisualizationViewer < V , E > ) e . getSource ( ) ; GraphElementAccessor < V , E > pickSupport = vv . getPickSupport ( ) ; PickedState < V > pickedVertexState = vv . getPickedVertexState ( ) ; Layout < V , E > layout = vv . getGraphLayout ( ) ; if ( pickSupport != null && pickedVertexState != null ) { Point2D p = e . getPoint ( ) ; vertex = pickSupport . getVertex ( layout , p . getX ( ) , p . getY ( ) ) ; if ( vertex != null ) { if ( pickedVertexState . isPicked ( vertex ) == false ) { pickedVertexState . clear ( ) ; pickedVertexState . pick ( vertex , true ) ; } } } e . consume ( ) ; } }
if the event occurs on a vertex , pick that single vertex
