Example usage for java.awt.event MouseEvent getClickCount

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

Introduction

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

Prototype

public int getClickCount() 

Source Link

Document

Returns the number of mouse clicks associated with this event.

Usage

From source file:org.kepler.gui.popups.LibraryPopupListener.java

/**
 * Description of the Method/*from   w ww . j  a va 2  s .  c  o  m*/
 * 
 *@param e
 *            Description of the Parameter
 */
private void maybeShowPopup(MouseEvent e) {
    if (isDebugging)
        log.debug("maybeShowPopup(" + e.toString() + ")");
    if (e.isPopupTrigger() || _trigger) {
        _trigger = false;
        TreePath selPath = _aptree.getPathForLocation(e.getX(), e.getY());
        if (isDebugging)
            log.debug(selPath.toString());
        if ((selPath != null)) {

            if (isDebugging)
                log.debug(selPath.getLastPathComponent().getClass().getName());

            if (_isPathInsideKAR(selPath)) {
                handlePopupInsideKar(selPath, e);
            } else {
                handlePopupOutsideKar(selPath, e);

            }
        }
        // handle double clicks
    } else if (e.getClickCount() == 2) {
        TreePath selPath = _aptree.getPathForLocation(e.getX(), e.getY());
        if (isDebugging)
            log.debug(selPath.toString());
        if ((selPath != null)) {

            if (isDebugging)
                log.debug(selPath.getLastPathComponent().getClass().getName());

            if (_isPathInsideKAR(selPath)) {
                handlePopupInsideKar(selPath, e);
            } else {
                handleDoubleClickOutsideKar(selPath, e);
            }
        }
    }
}

From source file:Gui.MainGuiBuilder.java

private void UserTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_UserTableMouseClicked
    // TODO add your handling code here:
    if (evt.getClickCount() == 1) {
        updateUser = new User((int) UserTable.getValueAt(UserTable.getSelectedRow(), 0),
                String.valueOf(UserTable.getValueAt(UserTable.getSelectedRow(), 1)),
                String.valueOf(UserTable.getValueAt(UserTable.getSelectedRow(), 2)),
                String.valueOf(UserTable.getValueAt(UserTable.getSelectedRow(), 3)),
                String.valueOf(UserTable.getValueAt(UserTable.getSelectedRow(), 4)),
                String.valueOf(UserTable.getValueAt(UserTable.getSelectedRow(), 5)),
                String.valueOf(UserTable.getValueAt(UserTable.getSelectedRow(), 6)),
                String.valueOf(UserTable.getValueAt(UserTable.getSelectedRow(), 7)));
    }/*from w  ww  . j a  v a2s .  c  o  m*/
    new GestUser(updateUser).setVisible(true);
}

From source file:streamme.visuals.Main.java

private void tree_filesMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tree_filesMousePressed
    PlaylistManager.get().clearSelection();
    switch (evt.getButton()) {
    case java.awt.event.MouseEvent.BUTTON1: // Left click
        if (evt.getClickCount() == 2) {
            playNodes();//from   w  ww. j ava 2 s. c  o  m
        }
        break;
    case java.awt.event.MouseEvent.BUTTON3: // Right click
        TreePath pathForLocation = tree_files.getPathForLocation(evt.getX(), evt.getY());
        tree_files.setSelectionPath(pathForLocation);
        treeMenu.show(tree_files, evt.getX(), evt.getY());
        break;
    }
}

From source file:Gui.MainGuiBuilder.java

private void PostTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PostTableMouseClicked
    // TODO add your handling code here:
    if (evt.getClickCount() == 1 && appUser.getMail()
            .equalsIgnoreCase(String.valueOf(PostTable.getValueAt(PostTable.getSelectedRow(), 9)))) {
        updatePost = new Post((int) PostTable.getValueAt(PostTable.getSelectedRow(), 0),
                String.valueOf(PostTable.getValueAt(PostTable.getSelectedRow(), 1)),
                String.valueOf(PostTable.getValueAt(PostTable.getSelectedRow(), 2)),
                String.valueOf(PostTable.getValueAt(PostTable.getSelectedRow(), 3)),
                String.valueOf(PostTable.getValueAt(PostTable.getSelectedRow(), 4)),
                String.valueOf(PostTable.getValueAt(PostTable.getSelectedRow(), 5)),
                String.valueOf(PostTable.getValueAt(PostTable.getSelectedRow(), 6)),
                String.valueOf(PostTable.getValueAt(PostTable.getSelectedRow(), 7)),
                (int) PostTable.getValueAt(PostTable.getSelectedRow(), 8));
    }/*from  www  . j av a 2  s  . c  o  m*/
    new GestPost(updatePost).setVisible(true);
}

From source file:com.proyecto.vista.MantenimientoBien.java

private void tblbienesMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblbienesMouseReleased
    // TODO add your handling code here:
    if (evt.getClickCount() == 1) {

        int fila = tblbienes.getSelectedRow();
        this.bien = lista.get(fila);

        try {//from   w  w  w  .j  ava 2  s . c o m
            nombreField.setText(BeanUtils.getProperty(bien, "nombre"));
            descripcionField.setText(BeanUtils.getProperty(bien, "descripcion"));
            fotoField.setText(BeanUtils.getProperty(bien, "foto"));

            ImageIcon fot = new ImageIcon(fotoField.getText());
            Icon icono = new ImageIcon(fot.getImage().getScaledInstance(fotoLbl.getWidth(), fotoLbl.getHeight(),
                    Image.SCALE_DEFAULT));
            fotoLbl.setIcon(icono);

            //                cmbClase.setSelectedItem(bien.getClase());
            claseField.setText(bien.getClase().getNombre());
            listarCamposMod(bien);
        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
            Logger.getLogger(MantenimientoClase.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}

From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java

private void symbolTableMouseClicked(MouseEvent evt) {
    if (evt.getClickCount() == 2) {
        Elf32_Sym symbol = (Elf32_Sym) symbolTable.getValueAt(symbolTable.getSelectedRow(), 0);
        if (symbol != null) {
            long address = symbol.st_value;

            jInstructionComboBox.setSelectedItem("0x" + Long.toHexString(address));
            jMainTabbedPane.setSelectedIndex(0);

            peterBochsDebugger.jumpToRowInstructionTable(BigInteger.valueOf(address));
        }/*from   ww  w. ja  va  2 s. c om*/
    }
}

From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java

private void codeBaseTableMouseClicked(MouseEvent evt) {
    if (evt.getClickCount() == 2) {
        File file = (File) codeBaseTable.getValueAt(codeBaseTable.getSelectedRow(), 3);
        try {//w  w  w  .  jav a2  s. c o  m
            InputStream in = new FileInputStream(file.getAbsolutePath());
            SourceDialog dialog = new SourceDialog(peterBochsDebugger, file.getAbsolutePath());
            dialog.enhancedTextArea1.setText(IOUtils.toString(in));
            IOUtils.closeQuietly(in);
            dialog.setLocationRelativeTo(peterBochsDebugger);
            dialog.setVisible(true);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

From source file:edu.ku.brc.specify.ui.AppBase.java

/**
 * Shows the About dialog./*from w w w. ja v a 2 s  .c o  m*/
 */
public void doAbout() {
    AppContextMgr acm = AppContextMgr.getInstance();
    boolean hasContext = acm.hasContext();

    int baseNumRows = 9;
    String serverName = AppPreferences.getLocalPrefs().get("login.servers_selected", null);
    if (serverName != null) {
        baseNumRows++;
    }

    CellConstraints cc = new CellConstraints();
    PanelBuilder infoPB = new PanelBuilder(new FormLayout("p,6px,f:p:g",
            "p,4px,p,4px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", baseNumRows)));

    JLabel iconLabel = new JLabel(IconManager.getIcon("SpecifyLargeIcon"), SwingConstants.CENTER); //$NON-NLS-1$
    PanelBuilder iconPB = new PanelBuilder(new FormLayout("p", "20px,t:p,f:p:g"));
    iconPB.add(iconLabel, cc.xy(1, 2));

    if (hasContext) {
        DBTableIdMgr tableMgr = DBTableIdMgr.getInstance();
        boolean hasReged = !RegisterSpecify.isAnonymous() && RegisterSpecify.hasInstitutionRegistered();

        int y = 1;
        infoPB.addSeparator(getResourceString("Specify.SYS_INFO"), cc.xyw(1, y, 3));
        y += 2;

        JLabel lbl = UIHelper.createLabel(databaseName);
        infoPB.add(UIHelper.createI18NFormLabel("Specify.DB"), cc.xy(1, y));
        infoPB.add(lbl, cc.xy(3, y));
        y += 2;
        lbl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    openLocalPrefs();
                }
            }
        });

        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Institution.getClassTableId())),
                cc.xy(1, y));
        infoPB.add(lbl = UIHelper.createLabel(acm.getClassObject(Institution.class).getName()), cc.xy(3, y));
        y += 2;
        lbl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    openRemotePrefs();
                }
            }
        });
        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Division.getClassTableId())), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(acm.getClassObject(Division.class).getName()), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Discipline.getClassTableId())), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(acm.getClassObject(Discipline.class).getName()), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createFormLabel(tableMgr.getTitleForId(Collection.getClassTableId())), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(acm.getClassObject(Collection.class).getCollectionName()), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createI18NFormLabel("Specify.BLD"), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(appBuildVersion), cc.xy(3, y));
        y += 2;

        infoPB.add(UIHelper.createI18NFormLabel("Specify.REG"), cc.xy(1, y));
        infoPB.add(UIHelper.createI18NLabel(hasReged ? "Specify.HASREG" : "Specify.NOTREG"), cc.xy(3, y));
        y += 2;

        String isaNumber = RegisterSpecify.getISANumber();
        infoPB.add(UIHelper.createI18NFormLabel("Specify.ISANUM"), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(StringUtils.isNotEmpty(isaNumber) ? isaNumber : ""), cc.xy(3, y));
        y += 2;

        if (serverName != null) {
            infoPB.add(UIHelper.createI18NFormLabel("Specify.SERVER"), cc.xy(1, y));
            infoPB.add(UIHelper.createLabel(StringUtils.isNotEmpty(serverName) ? serverName : ""), cc.xy(3, y));
            y += 2;
        }

        if (StringUtils.contains(DBConnection.getInstance().getConnectionStr(), "mysql")) {
            Vector<Object[]> list = BasicSQLUtils.query("select version() as ve");
            if (list != null && list.size() > 0) {
                infoPB.add(UIHelper.createFormLabel("MySQL Version"), cc.xy(1, y));
                infoPB.add(UIHelper.createLabel(list.get(0)[0].toString()), cc.xy(3, y));
                y += 2;
            }
        }

        infoPB.add(UIHelper.createFormLabel("Java Version"), cc.xy(1, y));
        infoPB.add(UIHelper.createLabel(System.getProperty("java.version")), cc.xy(3, y));
        y += 2;
    }

    String txt = getAboutText(appName, appVersion);
    JLabel txtLbl = createLabel(txt);
    txtLbl.setFont(UIRegistry.getDefaultFont());

    final JEditorPane txtPane = new JEditorPane("text/html", txt);
    txtPane.setEditable(false);
    txtPane.setBackground(new JPanel().getBackground());

    PanelBuilder pb = new PanelBuilder(new FormLayout("p,20px,f:min(400px;p):g,10px,8px,10px,p:g", "f:p:g"));

    pb.add(iconPB.getPanel(), cc.xy(1, 1));
    pb.add(txtPane, cc.xy(3, 1));
    Color bg = getBackground();

    if (hasContext) {
        pb.add(new VerticalSeparator(bg.darker(), bg.brighter()), cc.xy(5, 1));
        pb.add(infoPB.getPanel(), cc.xy(7, 1));
    }

    pb.setDefaultDialogBorder();

    String title = getResourceString("Specify.ABOUT");//$NON-NLS-1$
    CustomDialog aboutDlg = new CustomDialog(topFrame, title + " " + appName, true, CustomDialog.OK_BTN, //$NON-NLS-1$
            pb.getPanel());
    String okLabel = getResourceString("Specify.CLOSE");//$NON-NLS-1$
    aboutDlg.setOkLabel(okLabel);

    aboutDlg.createUI();
    aboutDlg.pack();

    // for some strange reason I can't get the dialog to size itself correctly
    Dimension size = aboutDlg.getSize();
    size.height += 120;
    aboutDlg.setSize(size);

    txtPane.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent event) {
            if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                try {
                    AttachmentUtils.openURI(event.getURL().toURI());

                } catch (Exception e) {
                    edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                }
            }
        }
    });

    UIHelper.centerAndShow(aboutDlg);
}

From source file:net.sf.firemox.DeckBuilder.java

public void mouseClicked(MouseEvent e) {
    if (e.getSource() == leftList && e.getClickCount() == 2) {
        refreshAddComponent(true);//from  w  w  w .  ja va  2 s .  co  m
    } else if (e.getSource() == removeButton && rightList.getSelectedRow() != -1) {
        removeCardFromDeck();
    } else if (e.getSource() == cardNameTxt) {
        cardNameTxt.selectAll();
    }
}

From source file:org.scify.talkandplay.gui.users.UserFormPanel.java

/**
 * The action listeners for the text fields and radio buttons
 *///ww  w  . j  a  va2s.c om
private void setActionListeners() {
    selectionSensorTextField1.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent me) {
            if (selectionSensorTextField1.isEnabled()) {
                selectionSensor = new MouseSensor(me.getButton(), me.getClickCount(), "mouse");
                navigationSensor = null;
                selectionSensorTextField1.setText(setSensorText(selectionSensor));
            }
        }
    });
    selectionSensorTextField1.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent ke) {
            if (selectionSensorTextField1.isEnabled()) {
                selectionSensor = new KeyboardSensor(ke.getKeyCode(), String.valueOf(ke.getKeyChar()),
                        "keyboard");
                navigationSensor = null;
                selectionSensorTextField1.setText(setSensorText(selectionSensor));
            }
        }
    });

    navigationSensorTextField.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent me) {
            if (navigationSensorTextField.isEnabled()) {
                navigationSensor = new MouseSensor(me.getButton(), me.getClickCount(), "mouse");
                navigationSensorTextField.setText(setSensorText(navigationSensor));
            }
        }
    });
    navigationSensorTextField.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent ke) {
            if (navigationSensorTextField.isEnabled()) {
                navigationSensor = new KeyboardSensor(ke.getKeyCode(), String.valueOf(ke.getKeyChar()),
                        "keyboard");
                navigationSensorTextField.setText(setSensorText(navigationSensor));
            }
        }
    });

    selectionSensorTextField2.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent me) {
            if (selectionSensorTextField2.isEnabled()) {
                selectionSensor = new MouseSensor(me.getButton(), me.getClickCount(), "mouse");
                selectionSensorTextField2.setText(setSensorText(selectionSensor));
            }
        }
    });
    selectionSensorTextField2.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent ke) {
            if (selectionSensorTextField2.isEnabled()) {
                selectionSensor = new KeyboardSensor(ke.getKeyCode(), String.valueOf(ke.getKeyChar()),
                        "keyboard");
                selectionSensorTextField2.setText(setSensorText(selectionSensor));
            }
        }
    });

    backButton.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent me) {
            parent.changePanel(new MainPanel(parent));
        }
    });

    autoScanRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            if (autoScanRadioButton.isSelected()) {
                disableTextField(selectionSensorTextField2);
                disableTextField(navigationSensorTextField);
                enableTextField(selectionSensorTextField1);
            }
        }
    });

    manualScanRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            if (manualScanRadioButton.isSelected()) {
                disableTextField(selectionSensorTextField1);
                enableTextField(selectionSensorTextField2);
                enableTextField(navigationSensorTextField);
            }
        }
    });

}