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:org.dodjsoft.tail.TailTopComponent.java

void showContextMenu(MouseEvent evt, TailFilePanel pane) {
    if (evt.getButton() == MouseEvent.BUTTON3) {
        contextMenu.setCurrentPane(pane);
        contextMenu.show(this, evt.getX(), evt.getY());
    }/*from w w  w.ja v  a  2 s  .com*/
}

From source file:org.kalypso.ogc.gml.widgets.base.PanToWidget.java

@Override
public void mouseReleased(final MouseEvent e) {
    if (!ArrayUtils.contains(m_mouseButtons, e.getButton()))
        return;// w  ww  . j  av a  2 s  .c o m

    if (m_world2screen == null)
        return;

    final Point point = e.getPoint();

    final GM_Position pixelPos = GeometryFactory.createGM_Position(point.getX(), point.getY());
    m_endPoint = m_world2screen.getSourcePoint(pixelPos);

    perform();
}

From source file:com.sec.ose.osi.ui.frm.main.report.project.JListProjectWithPopup.java

private void initialize() {
    this.addListSelectionListener(new FileSelectionListener());
    this.addMouseListener(new MouseAdapter() {
        @SuppressWarnings("deprecation")
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                log.debug("JLIstProjectWithPop.mouseClicked() : MouseEvent.BUTTON3");
                /// clicked right button
                mEventHandler.handle(EventHandler.RIGHT_BTN_CLICKED);

                if (JListProjectWithPopup.this.getSelectedValues() != null // existed selected item
                        && JListProjectWithPopup.this.getSelectedValues().length > 0) {
                    log.debug("button3");
                    mPopup.show(e.getComponent(), e.getX(), e.getY());
                }/*from   w  w w. j av  a2 s .  c o m*/
            }
        }
    });
}

From source file:org.kalypso.ogc.gml.widgets.base.PanToWidget.java

@Override
public void mousePressed(final MouseEvent e) {
    if (!ArrayUtils.contains(m_mouseButtons, e.getButton()))
        return;/*from   w w  w .j  a v  a 2 s .  c  o  m*/

    final IMapPanel mapPanel = getMapPanel();
    if (mapPanel == null)
        return;

    final Point point = e.getPoint();

    m_world2screen = mapPanel.getProjection();
    if (m_world2screen == null)
        return;

    final GM_Position pixelPos = GeometryFactory.createGM_Position(point.getX(), point.getY());
    m_startPoint = m_world2screen.getSourcePoint(pixelPos);

    m_endPoint = null;
}

From source file:ru.codemine.pos.ui.windows.document.cheque.ChequeListWindow.java

@Override
public void setupActionListeners() {
    setEditActionListener(viewCheque);/*  w  ww. j av a2s . c  om*/

    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.users.UsersListWindow.java

@Override
public void setupActionListeners() {
    setNewActionListener(newUser);/* ww  w. ja v a2  s .co  m*/
    setEditActionListener(editUser);
    setDeleteActionListener(deleteUser);
    setRefreshActionListener(refreshUsersList);

    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.stores.StoresListWindow.java

@Override
public void setupActionListeners() {
    setNewActionListener(newStore);//  w  w  w .  java 2 s  .  co m
    setEditActionListener(editStore);
    setDeleteActionListener(deleteStore);
    setRefreshActionListener(refreshStoreList);

    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.ui.rrm.internal.map.editRelation.EditRelationWidget.java

@Override
public void mouseReleased(final MouseEvent e) {
    if (e.getButton() != MouseEvent.BUTTON1)
        return;/*from  w w  w  .  j  ava  2  s  .  c om*/

    m_performRunner.execute();
}

From source file:ru.codemine.pos.ui.windows.devices.barcodescanner.BarcodeScannerListWindow.java

@Override
public void setupActionListeners() {
    setNewActionListener(newBarcodeScannerDevice);
    setEditActionListener(editBarcodeScannerDevice);
    setDeleteActionListener(deleteBarcodeScannerDevice);
    setProcessActionListener(setActiveBarcodeScannerDevice);
    setRefreshActionListener(refreshBarcodeScannerDeviceList);

    table.addMouseListener(new MouseAdapter() {
        @Override/*w  w  w.  j  a  va  2  s  .c om*/
        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:lu.lippmann.cdb.graph.mouse.CadralEditingGraphMousePlugin.java

/**
 * When we are editing the graph : publish an event to select the node if 
 * we right click on an existing node (to edit its properties)
 *///from   w  w w .  ja v  a 2  s . com
@SuppressWarnings("unchecked")
@Override
public void mouseClicked(MouseEvent e) {
    if (e.getButton() == 3) { //right click
        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) {
                commandDispatcher.dispatch(new SelectNodeCommand(vertex, 2));
            } else {
                final CEdge edge = pickSupport.getEdge(layout, p.getX(), p.getY());
                if (edge != null) {
                    commandDispatcher.dispatch(new SelectEdgeCommand(edge, 2));
                }
            }
        }
    }
}