Example usage for java.awt.event MouseEvent BUTTON3

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

Introduction

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

Prototype

int BUTTON3

To view the source code for java.awt.event MouseEvent BUTTON3.

Click Source Link

Document

Indicates mouse button #3; used by #getButton .

Usage

From source file:simMPLS.ui.simulator.JVentanaHija.java

/** Este mtodo se ejecuta cuando se hace clic con el botn derecho en la pantalla
 * de diseo./*from   ww w .j  ava2  s  .  c  om*/
 * @since 1.0
 * @param evt Evento que hace que este mtodo se dispare.
 */
private void clicDerechoEnPanelDisenio(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clicDerechoEnPanelDisenio
    if (evt.getButton() == MouseEvent.BUTTON3) {
        TTopologyElement et = escenario.getTopology().obtenerElementoEnPosicion(evt.getPoint());
        if (et == null) {
            diseFondoPopUp.show(this, evt.getX() + 7, evt.getY() - 27);
        } else {
            if (et.getElementType() == TTopologyElement.NODO) {
                TNode nt = (TNode) et;
                dVerNombreMenuItem.setSelected(nt.getShowName());
                elementoDisenioClicDerecho = et;
                diseElementoPopUp.show(this, evt.getX() + 7, evt.getY() + 15);
            } else if (et.getElementType() == TTopologyElement.LINK) {
                TLink ent = (TLink) et;
                dVerNombreMenuItem.setSelected(ent.obtenerMostrarNombre());
                elementoDisenioClicDerecho = et;
                diseElementoPopUp.show(this, evt.getX() + 7, evt.getY() + 15);
            }
        }
    } else {
        elementoDisenioClicDerecho = null;
        panelDisenio.repaint();
    }
}

From source file:GUI.MainWindow.java

private void handleAffectedHosts(MouseEvent evt) {

    Object obj = this.VulnTree.getLastSelectedPathComponent();
    if (obj == null) {
        return;//from ww  w  . j  a  v  a2s.  c om
    }

    int row = VulnAffectedHostsTable.getSelectedRow();
    if (row == -1) // No vulns selected
    {
        // Setup the context menu as required
        EditHostname.setEnabled(false);
        DeleteHost.setEnabled(false);
    } else { // A vuln is selected
        // Setup the context menu as required
        EditHostname.setEnabled(true);
        DeleteHost.setEnabled(true);
    }

    if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) {
        // this was a double click on  the try
        showNotesForSpecificHost();
    } else if (evt.getButton() == MouseEvent.BUTTON3) {

        VulnAffectedHostsContextMenu.show(VulnAffectedHostsTable, evt.getX(), evt.getY());
    }
}

From source file:app.RunApp.java

/**
 * Action when mouse released of Co-ocurrence panel
 * /*from   w w  w  . ja v a 2s  . c  o  m*/
 * @param evt Event
 */
private void panelCoOcurrenceMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_panelCoOcurrenceMouseReleased
    if (evt.getButton() == MouseEvent.BUTTON3) {
        jPopupMenu1.removeAll();

        JMenuItem saver = new JMenuItem("Save as...");

        saver.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                try {
                    saveCoocurrenceGraph();
                } catch (AWTException | IOException ex) {
                    Logger.getLogger(RunApp.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

        jPopupMenu1.add(saver);
        jPopupMenu1.show(evt.getComponent(), evt.getX(), evt.getY());
    }
}

From source file:v800_trainer.JCicloTronic.java

private void DatentabelleMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DatentabelleMouseClicked
    // Add your handling code here:
    if (evt.getButton() == MouseEvent.BUTTON3 && evt.getButton() != MouseEvent.BUTTON1) {

        int dummy = Datentabelle.rowAtPoint(evt.getPoint());
        int selection[] = Datentabelle.getSelectedRows();

        boolean isselected = false;
        for (int i = 0; i < selection.length; i++) {
            if (dummy == selection[i]) {
                isselected = true;/* w  w w  .j a  va  2 s  .  c o  m*/
            }
        }
        ;
        Datentabelle.clearSelection();
        if (!isselected) {
            Datentabelle.addRowSelectionInterval(dummy, dummy);
        }

        for (int i = 0; i < selection.length; i++) {
            if (dummy != selection[i]) {
                Datentabelle.addRowSelectionInterval(selection[i], selection[i]);
            }

        }

    }
    SelectionChanged = true;
    Update = false;
    Datenliste_Monat.setEnabled(false);
    Datenliste_Monat.setSelectedIndex(0);
    Datenliste_Jahr.setSelectedIndex(0);
    Datenliste_Zeitabschnitt.setSelectedIndex(0);
    Datenliste_TourTyp.setSelectedIndex(0);

    Update = true;
    jLabel69_Selektiert.setText(Datentabelle.getSelectedRowCount() + " / " + Datentabelle.getRowCount());
    if (evt.getClickCount() == 2) {
        Hauptfenster.setSelectedIndex(1);
    }
}