Example usage for java.awt.event KeyEvent VK_ENTER

List of usage examples for java.awt.event KeyEvent VK_ENTER

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_ENTER.

Prototype

int VK_ENTER

To view the source code for java.awt.event KeyEvent VK_ENTER.

Click Source Link

Document

Constant for the ENTER virtual key.

Usage

From source file:org.martin.ftp.gui.GUIClient.java

private void txtNewDirKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNewDirKeyReleased

    String dir = txtNewDir.getText().trim();

    if (evt.getKeyCode() == KeyEvent.VK_ENTER)
        if (!dir.isEmpty()) {
            try {
                linker.setWorkingDirectory(dir);
                updateTable();/* ww w .j a  v  a  2  s .  com*/
            } catch (IOException ex) {
                Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

}

From source file:org.martin.ftp.gui.GUIClient.java

private void tblFilesKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tblFilesKeyPressed

    if (evt.getKeyCode() == KeyEvent.VK_ENTER)
        try {//from  w w w.j  a  va 2 s .  c  o  m
            setWorkingDirectory();
        } catch (IOException ex) {
            Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex);
        }
}

From source file:org.martin.ftp.gui.GUIClient.java

private void txtNewFolderKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNewFolderKeyReleased

    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {

        String nameFolder = txtNewFolder.getText().trim();

        if (!nameFolder.isEmpty()) {
            try {
                linker.createDirectory(directorioActual, nameFolder);
                updateTable();//  w  w w.j a  v  a  2  s . c  om
            } catch (IOException ex) {
                Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        txtNewFolder.setText(null);
        dialogNewFolder.hide();
    }
}

From source file:br.com.atmatech.sac.view.ViewAtendimento.java

private void jTajudaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTajudaKeyPressed
    // TODO add your handling code here:
    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
        consultaAjuda();/*ww w.j ava2  s.  c om*/
    }
}

From source file:org.sikuli.ide.SikuliIDE.java

private JComponent createSearchField() {
    _searchField = new JXSearchField("Find");
    _searchField.setUseNativeSearchFieldIfPossible(true);
    //_searchField.setLayoutStyle(JXSearchField.LayoutStyle.MAC);
    _searchField.setMinimumSize(new Dimension(220, 30));
    _searchField.setPreferredSize(new Dimension(220, 30));
    _searchField.setMaximumSize(new Dimension(380, 30));
    _searchField.setMargin(new Insets(0, 3, 0, 3));
    _searchField//from   w  w w . j  a v a  2 s .com
            .setToolTipText("Search is case sensitive - " + "start with ! to make search not case sensitive");

    _searchField.setCancelAction(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            getCurrentCodePane().requestFocus();
            _findHelper.setFailed(false);
        }
    });
    _searchField.setFindAction(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            //FIXME: On Linux the found selection disappears somehow
            if (!Settings.isLinux()) //HACK
            {
                _searchField.selectAll();
            }
            boolean ret = _findHelper.findNext(_searchField.getText());
            _findHelper.setFailed(!ret);
        }
    });
    _searchField.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(java.awt.event.KeyEvent ke) {
            boolean ret;
            if (ke.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
                //FIXME: On Linux the found selection disappears somehow
                if (!Settings.isLinux()) //HACK
                {
                    _searchField.selectAll();
                }
                ret = _findHelper.findNext(_searchField.getText());
            } else {
                ret = _findHelper.findStr(_searchField.getText());
            }
            _findHelper.setFailed(!ret);
        }
    });
    return _searchField;
}

From source file:org.martin.ftp.gui.GUIClient.java

private void txtSearchFilterKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSearchFilterKeyReleased

    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {

        String filter = txtSearchFilter.getText().trim();

        if (!filter.isEmpty()) {

            tSearcher = new Thread(() -> {
                btnCancelSearch.setEnabled(true);
                openWindow(dialogSearchLoader, formSearch);
                txtSearchFilter.setEnabled(false);
                try {
                    Searcher.getInstance(linker, tblSearch).search(filter);
                } catch (IOException ex) {
                    Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex);
                }//  w  w w  .  ja va2 s  .c  o  m
                dialogSearchLoader.hide();
                txtSearchFilter.setEnabled(true);
                btnCancelSearch.setEnabled(false);
                if (Searcher.getInstance(linker, tblSearch).hasResults()) {
                    cboOrderOptionS.setEnabled(true);
                    cboOrderTypeS.setEnabled(true);
                    btnOrderFilesS.setEnabled(true);
                } else if (cboOrderOptionS.isEnabled() && cboOrderTypeS.isEnabled()
                        && btnOrderFilesS.isEnabled()) {
                    cboOrderOptionS.setEnabled(false);
                    cboOrderTypeS.setEnabled(false);
                    btnOrderFilesS.setEnabled(false);
                }

                JOptionPane.showMessageDialog(formSearch, "Busqueda Finalizada");
            });
            tSearcher.start();
        }
    }
}

From source file:org.martin.ftp.gui.GUIClient.java

private void txtNewNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNewNameKeyReleased

    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {

        String text = txtNewName.getText();

        if (!text.isEmpty()) {
            try {
                FTPFile selected = getFile(selectedIndex);
                linker.rename(selected, text.trim());
                updateTable();//from   w  ww.j ava2 s.co m
                JOptionPane.showMessageDialog(dialogFileOptions, "Archivo renombrado exitosamente");
            } catch (IOException ex) {
                Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        dialogRename.hide();
    }
}

From source file:org.martin.ftp.gui.GUIClient.java

private void tblSearchKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tblSearchKeyPressed

    if (evt.getKeyCode() == KeyEvent.VK_ENTER)
        try {//from  w w w  . j a  v  a2s  .  com
            goToFile();
        } catch (IOException ex) {
            Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex);
        }
}

From source file:org.martin.ftp.gui.GUIClient.java

private void txtMyHostKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMyHostKeyReleased

    String text = txtMyHost.getText();

    if (evt.getKeyCode() == KeyEvent.VK_ENTER || evt.getKeyCode() == KeyEvent.VK_TAB) {

        if (!text.isEmpty()) {
            txtMyHost.setText(text.trim());
        }// www.  ja  va2s .co  m

        if (!txtMyUser.getText().trim().isEmpty())
            txtMyUser.selectAll();
        txtMyUser.requestFocus();
    }
}

From source file:org.martin.ftp.gui.GUIClient.java

private void txtMyUserKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMyUserKeyReleased

    String text = txtMyUser.getText();

    if (evt.getKeyCode() == KeyEvent.VK_ENTER || evt.getKeyCode() == KeyEvent.VK_TAB) {

        if (!text.isEmpty()) {
            txtMyUser.setText(text.trim());
        }/*from   w ww  .j  a  va2 s .  c  o  m*/

        if (!txtMyPass.getText().trim().isEmpty())
            txtMyPass.selectAll();
        txtMyPass.requestFocus();
    }
}