Example usage for java.awt.event MouseEvent getButton

List of usage examples for java.awt.event MouseEvent getButton

Introduction

In this page you can find the example usage for java.awt.event MouseEvent getButton.

Prototype

public int getButton() 

Source Link

Document

Returns which, if any, of the mouse buttons has changed state.

Usage

From source file:lu.lippmann.cdb.graph.mouse.CadralEditingGraphMousePlugin.java

/**
 * {@inheritDoc}/*from   www .jav a 2  s  . c  om*/
 */
@Override
public void mousePressed(MouseEvent e) {
    if (e.getButton() != 3) { //not with left click
        @SuppressWarnings("unchecked")
        final VisualizationViewer<CNode, CEdge> vv = (VisualizationViewer<CNode, CEdge>) e.getSource();
        final Point2D p = e.getPoint();
        final Layout<CNode, CEdge> layout = vv.getModel().getGraphLayout();
        final GraphElementAccessor<CNode, CEdge> pickSupport = vv.getPickSupport();
        if (pickSupport != null) {
            final CNode vertex = pickSupport.getVertex(layout, p.getX(), p.getY());
            if (vertex == null) {
                return;
            } else {
                //set fields for mouseReleased
                startVertex = vertex;
                down = e.getPoint();
                vv.addPostRenderPaintable(edgePaintable);
                vv.addPostRenderPaintable(arrowPaintable);
                edgeIsDirected = EdgeType.DIRECTED;
            }
        }
    }
}

From source file:se.trixon.jota.client.ui.editor.JobsPanel.java

private void listMouseClicked(java.awt.event.MouseEvent evt) {
    if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) {
        editButtonActionPerformed(null);
    }//from w  w  w .j a  va  2  s .  com
}

From source file:ru.codemine.pos.ui.windows.devices.kkm.KkmListWindow.java

@Override
public void setupActionListeners() {
    setNewActionListener(newKkmDevice);//from   w w  w .  j av  a2  s .c  om
    setEditActionListener(editKkmDevice);
    setDeleteActionListener(deleteKkm);
    setProcessActionListener(setActiveKkm);
    setRefreshActionListener(refreshKkmDeviceList);
    toolButtonTestCheque.addActionListener(testKkmDevice);

    table.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            int row = table.rowAtPoint(p);
            if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
                menuItemEdit.doClick();
            }
        }
    });

    actionListenersInit = true;
}

From source file:ru.codemine.pos.ui.windows.products.ProductsListWindow.java

@Override
public void setupActionListeners() {
    setNewActionListener(newProduct);/* w w  w . j a v a  2 s .c  o  m*/
    setEditActionListener(editProduct);
    setDeleteActionListener(deleteProduct);
    setRefreshActionListener(refreshProductList);

    toolButtonPrintStickers.addActionListener(printProductStickers);
    menuItemPrintStickers.addActionListener(printProductStickers);

    table.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            int row = table.rowAtPoint(p);
            if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
                menuItemEdit.doClick();
            }
        }
    });

    actionListenersInit = true;
}

From source file:org.kalypso.model.wspm.ui.action.selection.AbstractProfilePointSelectionWidget.java

@Override
public void mousePressed(final MouseEvent e) {
    if (m_viewMode)
        return;/*  w w  w. j  av a2s . c  o m*/

    if (MouseEvent.BUTTON1 != e.getButton())
        return;

    final boolean shiftDown = e.isShiftDown();
    if (!shiftDown)
        m_p0 = getSnapPoint();

    updateSelection(shiftDown);
}

From source file:org.fhcrc.cpl.viewer.mrm.utilities.MRMerMouseListener.java

public void mouseEntered(MouseEvent e) {
    if ((e.isShiftDown() || e.getButton() == MouseEvent.BUTTON3) || shifted) {

    } else {/*  w  w  w  . j a v a  2s . co m*/
        _cp.mouseEntered(e);
    }
}

From source file:org.fhcrc.cpl.viewer.mrm.utilities.MRMerMouseListener.java

public void mouseExited(MouseEvent e) {
    if ((e.isShiftDown() || e.getButton() == MouseEvent.BUTTON3) || shifted) {

    } else {/* ww w  .ja  v a2 s .  c o  m*/
        _cp.mouseExited(e);
    }
}

From source file:org.fhcrc.cpl.viewer.mrm.utilities.MRMerMouseListener.java

public void mouseMoved(MouseEvent e) {
    if ((e.isShiftDown() || e.getButton() == MouseEvent.BUTTON3) || shifted) {
        _cp.mouseMoved(e);//  w  ww  .  ja  v a 2 s.c om
    } else {
        _cp.mouseMoved(e);
    }
}

From source file:se.trixon.jota.client.ui.editor.module.DualListPanel.java

private void initListeners() {
    availableListPanel.getList().addMouseListener(new MouseAdapter() {
        @Override//from   ww w.ja  va2  s.c  om
        public void mouseClicked(MouseEvent evt) {
            if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) {
                activate();
            }
        }
    });

    selectedListPanel.getList().addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) {
                deactivate();
            }
        }
    });
}

From source file:playground.sergioo.facilitiesGenerator2012.gui.ClustersPanel.java

@Override
public void mouseClicked(MouseEvent e) {
    double[] p = getWorld(e.getX(), e.getY());
    if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON3)
        camera.centerCamera(p);/*from  w  w  w.j  a  v  a2  s.c  o  m*/
    else {
        if (window.getOption().equals(Options.ZOOM) && e.getButton() == MouseEvent.BUTTON1)
            camera.zoomIn(p[0], p[1]);
        else if (window.getOption().equals(Options.ZOOM) && e.getButton() == MouseEvent.BUTTON3)
            camera.zoomOut(p[0], p[1]);
    }
    repaint();
}