/** * This is the interface for adding a mouse listener. The GEL * will be called back with mouse clicks on vertices. * @param gel the mouse listener to add */ public void addGraphMouseListener( GraphMouseListener<V> gel ) { addMouseListener( new MouseListenerTranslator<V,E>( gel, this )); }
/** * This is the interface for adding a mouse listener. The GEL will be called back with mouse * clicks on nodes. * * @param gel the mouse listener to add */ public void addGraphMouseListener(GraphMouseListener<N> gel) { addMouseListener(new MouseListenerTranslator<N, E>(gel, this)); }
public VisualizationViewer(VisualizationModel<V,E> model, Dimension preferredSize) { super(model, preferredSize); setFocusable(true); addMouseListener(requestFocusListener); }
/** * @param model the model for the view * @param preferredSize the initial size of the window to display the network */ public VisualizationViewer(VisualizationModel<N, E> model, Dimension preferredSize) { super(model, preferredSize); setFocusable(true); addMouseListener(requestFocusListener); }
vv.getRenderer().getNodeLabelRenderer().setPosition(Renderer.NodeLabel.Position.CNTR); vv.addMouseListener( new MouseAdapter() { @Override
vv.setForeground(Color.black); vv.getRenderContext().setVertexFillPaintTransformer(vertexPainter); vv.addMouseListener(mouseListener); vv.setVertexToolTipTransformer(vertexToolTipTransformer);
vv.addMouseListener( new MouseAdapter() { @Override
addMouseListener(graphMouse); addMouseMotionListener(graphMouse); addMouseWheelListener(graphMouse);
/** * a setter for the GraphMouse. This will remove any previous GraphMouse (including the one that * is added in the initMouseClicker method. * * @param graphMouse new value */ public void setGraphMouse(GraphMouse graphMouse) { this.graphMouse = graphMouse; MouseListener[] ml = getMouseListeners(); for (int i = 0; i < ml.length; i++) { if (ml[i] instanceof GraphMouse) { removeMouseListener(ml[i]); } } MouseMotionListener[] mml = getMouseMotionListeners(); for (int i = 0; i < mml.length; i++) { if (mml[i] instanceof GraphMouse) { removeMouseMotionListener(mml[i]); } } MouseWheelListener[] mwl = getMouseWheelListeners(); for (int i = 0; i < mwl.length; i++) { if (mwl[i] instanceof GraphMouse) { removeMouseWheelListener(mwl[i]); } } addMouseListener(graphMouse); addMouseMotionListener(graphMouse); addMouseWheelListener(graphMouse); }
visualizationViewer.addMouseListener(graphMouseListener);
add(vv, BorderLayout.CENTER); vv.addMouseListener(this); addComponentListener(this); vv.addGraphMouseListener(this);
add(vv, BorderLayout.CENTER); vv.addMouseListener(this); addComponentListener(this); vv.addGraphMouseListener(this);