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:ru.goodfil.catalog.ui.forms.FiltersPanel.java

private void tblOesMouseClicked(MouseEvent e) {
    if (e.getButton() == MouseEvent.BUTTON3) {
        if (oes.size() > 0) {
            tablesPopupMenu.show(tblOes, e.getX(), e.getY());
        }/* w w  w .  ja  va  2 s .  com*/
    }
}

From source file:ru.goodfil.catalog.ui.forms.FiltersPanel.java

private void tblAllOesMouseClicked(MouseEvent e) {
    if (e.getButton() == MouseEvent.BUTTON3) {
        if (allOes.size() > 0) {
            tablesPopupMenu.show(tblAllOes, e.getX(), e.getY());
        }//from   ww  w  . j a va 2 s  . c o  m
    }
}

From source file:com.farouk.projectapp.FirstGUI.java

private void jTable2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable2MouseClicked
    jList1.clearSelection();//from   w  ww  . ja v  a 2s  .  c o  m
    int row = jTable2.getSelectedRow();
    String name = (jTable2.getModel().getValueAt(row, 0).toString());
    jLabel15.setText("Selected company : '" + name + "'.    " + SQLConnect.checkIfAutomated(userID, name));
    if (jTabbedPane1.getSelectedIndex() == 0) {
        jButton10.setVisible(true);
        jButton7.setVisible(true);
        if (SQLConnect.ifAutomated(userID, name) == 1) {
            jButton15.setText("De-Auto");
        } else if (SQLConnect.ifAutomated(userID, name) == 0) {
            jButton15.setText("Automate");
        }
        if (SQLConnect.ifAutomated(userID, name) == 2) {
            jButton19.setText("De-Alert");
        } else {
            jButton19.setText("Alert");
        }
        jButton15.setVisible(true);
        if (SQLConnect.ifReported(userID, name) == 1) {
            jButton3.setText("Unreport");
        } else {
            jButton3.setText("Report");
        }

        jButton3.setVisible(true);
        jPanel10.setVisible(false);
        StringThirdParty = name;
        jTextField6.setText(name);
    }
    try {
        if (evt.getButton() == MouseEvent.BUTTON3) {

            int decision = JOptionPane.showConfirmDialog(rootPane, "Do you really want to delete " + name + "?",
                    "Remove a company", JOptionPane.YES_NO_OPTION);
            if (decision == JOptionPane.YES_OPTION) {
                SQLConnect.removeCompanyFromPortfolio(name, userID);
                UpdatejTable2();
                SQLConnect.registerTotalChanges(userID, total);
            }

        }
    } catch (Exception e) {
        System.err.println(e);
    }

}

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

/** Este mtodo se llama automticamente cuando se hace un clic con el botn
 * izquierdo sobre la pantalla de diseo.
 * @since 1.0//from   ww w  .j av a 2 s.co  m
 * @param evt Evento que hace que se dispare este mtodo.
 */
private void clicEnPanelDisenio(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clicEnPanelDisenio
    if (evt.getButton() == MouseEvent.BUTTON1) {
        TTopology topo = escenario.getTopology();
        nodoSeleccionado = topo.obtenerNodoEnPosicion(evt.getPoint());
        if (nodoSeleccionado != null) {
            nodoSeleccionado.setStatus(TNode.SELECCIONADO);
            this.escenario.setModified(true);
        }
        panelDisenio.repaint();
    }
}

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

/** Este mtodo se llama automticamente cuando soltamos el botn del raton a la
 * rrastrar o al hacer clic. Si el ratn estaba sobre  un elemento de la topology,
 se marca ste como no seleccionado./*from  ww  w .  jav a  2  s.  c o m*/
 * @since 1.0
 * @param evt El evento que hace que se dispare este mtodo.
 */
private void clicSoltadoEnPanelDisenio(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clicSoltadoEnPanelDisenio
    if (evt.getButton() == MouseEvent.BUTTON1) {
        if (nodoSeleccionado != null) {
            nodoSeleccionado.setStatus(TNode.DESELECCIONADO);
            nodoSeleccionado = null;
            this.escenario.setModified(true);
        }
        panelDisenio.repaint();
    }
}

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

/**
 * Este mtodo se llama cuando se libera un botn del ratn estando en el panel de
 * simulacin. Si se hace sobre un elemento que estaba seleccionado, deja de
 * estarlo./*from  ww w. j a  v  a2  s  . co  m*/
 * When the mouse button is released on a node
 * @param evt El evento que genera la llamada.
 * @since 1.0
 */
private void ratonSoltadoEnPanelSimulacion(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ratonSoltadoEnPanelSimulacion
    if (evt.getButton() == MouseEvent.BUTTON1) {
        if (nodoSeleccionado != null) {
            nodoSeleccionado.setStatus(TNode.DESELECCIONADO);
            nodoSeleccionado = null;
            this.escenario.setModified(true);
        }
        panelSimulacion.repaint();
    }
}

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

/**
 * Este mtodo se llama cuando se presiona un botn del ratn en el panel de
 * simulacin. Si se hace sobre un elemento de la topologa, lo marca como
 * seleccionado.//from   w w  w  .ja va 2s .  c o m
 * When the mouse button is pressed on a node
 * @since 1.0
 * @param evt El evento que provoca la llamada.
 */
private void clicEnPanelSimulacion(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clicEnPanelSimulacion
    if (evt.getButton() == MouseEvent.BUTTON1) {
        TTopology topo = escenario.getTopology();
        TTopologyElement et = topo.obtenerElementoEnPosicion(evt.getPoint());
        if (et != null) {
            this.setCursor(new Cursor(Cursor.HAND_CURSOR));
            if (et.getElementType() == TTopologyElement.NODO) {
                TNode nt = (TNode) et;
                nodoSeleccionado = nt;
                if (nodoSeleccionado != null) {
                    nodoSeleccionado.setStatus(TNode.SELECCIONADO);
                    this.escenario.setModified(true);
                }
            }
        } else {
            this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            this.setToolTipText(null);
        }
        panelSimulacion.repaint();
    }
}

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 w  w  w . j  av a  2 s  . co  m
 * @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:simMPLS.ui.simulator.JVentanaHija.java

/** Action when the mouse button is pressed and released
 * @since 1.0//  ww w.j  a  va2  s  . com
 */
private void ratonPulsadoYSoltadoEnPanelSimulacion(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ratonPulsadoYSoltadoEnPanelSimulacion
    if (evt.getButton() == MouseEvent.BUTTON1) {
        TTopologyElement et = escenario.getTopology().obtenerElementoEnPosicion(evt.getPoint());
        if (et != null) {
            if (et.getElementType() == TTopologyElement.NODO) {
                TNode nt = (TNode) et;
                nt.toCongest();
            } else if (et.getElementType() == TTopologyElement.LINK) {
                //                    TLink ent = (TLink) et;
                //                    if (ent.isBroken()) {
                //                        ent.ponerEnlaceCaido(false);
                //                    } else {
                //                        ent.ponerEnlaceCaido(true);
                //                    }
            }
        } else {
            if (this.panelSimulacion.obtenerMostrarLeyenda()) {
                this.panelSimulacion.ponerMostrarLeyenda(false);
            } else {
                this.panelSimulacion.ponerMostrarLeyenda(true);
            }
        }
    } else if (evt.getButton() == MouseEvent.BUTTON3) {
        TTopologyElement et = escenario.getTopology().obtenerElementoEnPosicion(evt.getPoint());
        if (et != null) {
            if (et.getElementType() == TTopologyElement.LINK) {
                TLink ent = (TLink) et;
                if (!ent.isBroken()) {
                    JWindowLinkDump linkWindow = new JWindowLinkDump(VentanaPadre, true, ent);
                    linkWindow.setVisible(true);
                }
            }
        }
    } else {
        elementoDisenioClicDerecho = null;
        panelDisenio.repaint();
    }
}

From source file:edu.purdue.cc.bionet.ui.CorrelationDisplayPanel.java

/**
 * Creates a Correlation Graph.//w  w w . j ava2s  . c  om
 * 
 * @param experiments An Experiment Object containing the data to be used.
 */
public boolean createView(Collection<Experiment> experiments) {
    if (experiments.size() == 0) {
        return false;
    }
    this.setBackground(Color.WHITE);
    this.setVisible(true);
    this.title = Settings.getLanguage().get("Correlation Network");
    this.molecules = new TreeSet<Molecule>();
    for (Experiment experiment : experiments) {
        this.molecules.addAll(experiment.getMolecules());
        experiment.updateCorrelations();
    }
    this.samples = new TreeSet<Sample>();
    this.experiments = experiments;
    this.correlations = new CorrelationSet(molecules, samples);
    for (Experiment experiment : this.experiments) {
        for (Sample sample : experiment.getSamples()) {
            this.samples.add(sample);
        }
        for (Molecule molecule : experiment.getMolecules()) {
            this.moleculeFilterPanel.add(molecule);
            this.molecules.add(molecule);
            this.correlations.add(molecule);
        }
    }

    this.graph = new CorrelationGraphVisualizer(this.correlations,
            this.correlationFilterPanel.getMonitorableRange());
    this.addSampleGroupChangeListener(this.graph);
    this.saveImageAction.setComponent(this.graph);
    this.graph.setBackground(this.getBackground());
    this.graph.setIndicateCommonNeighbors(true);
    this.infoPanel = new InfoPanel();
    this.addSampleGroupChangeListener(this.infoPanel);
    this.graph.addGraphMouseListener(new CorrelationGraphMouseListener());

    this.graph.addGraphMouseEdgeListener(new GraphMouseListener<Correlation>() {

        public void graphClicked(Correlation c, MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() >= 2) {
                new DetailWindow(correlations, c, correlationFilterPanel.getRange(),
                        correlationMethod.intValue());
            }
        }

        public void graphPressed(Correlation c, MouseEvent e) {
        }

        public void graphReleased(Correlation c, MouseEvent e) {
        }
    });

    Collection<SampleGroup> sampleGroups = new ArrayList<SampleGroup>();
    sampleGroups.add(new SampleGroup("All Samples", this.samples));
    this.setSampleGroups(sampleGroups);

    this.add(this.graphSplitPane, BorderLayout.CENTER);
    this.graphSplitPane.setBottomComponent(this.infoPanel);
    this.setGraphVisualizer(this.graph);

    this.heatMapPanel = new HeatMap(this.getTitle(), this.correlations, this.getCorrelationRange(),
            this.correlationMethod);
    this.graph.addVertexChangeListener(this.heatMapPanel);
    this.pearsonCalculationMenuItem.addChangeListener(this.heatMapPanel);
    this.spearmanCalculationMenuItem.addChangeListener(this.heatMapPanel);
    this.kendallCalculationMenuItem.addChangeListener(this.heatMapPanel);
    this.addComponentListener(new InitialSetup());
    return true;
}