Example usage for java.awt.event KeyEvent getKeyCode

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

Introduction

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

Prototype

public int getKeyCode() 

Source Link

Document

Returns the integer keyCode associated with the key in this event.

Usage

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  w w . ja  va 2s . c  om*/
                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 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 a2  s.c om*/
            } catch (IOException ex) {
                Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

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

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);
                }//from ww  w.  j a  v  a2s .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 txtServerKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtServerKeyReleased

    String text = txtServer.getText();

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

        txtUser.requestFocus();// w w w . ja v  a 2 s . c o m
        if (!txtUser.getText().isEmpty())
            txtUser.selectAll();

    }
}

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

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

    String text = txtUser.getText();

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

        if (!text.trim().isEmpty())
            txtUser.setText(text.trim());

        txtPassword.requestFocus();/*from  w w w.  j a  v a  2 s .c o m*/
        if (!txtPassword.getText().isEmpty())
            txtPassword.selectAll();

    }

}

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());
        }/*  w w w. ja  v a 2  s .c  o 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());
        }/*w  w  w.  jav a 2  s .c  o m*/

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

From source file:osu.beatmapdownloader.JFrame.java

private void T_PassKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_T_PassKeyPressed
       if (evt.getKeyCode() == KeyEvent.VK_ENTER)
           login();//from  w w  w .  ja v a 2s  .c  o  m
   }

From source file:osu.beatmapdownloader.JFrame.java

private void T_UserKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_T_UserKeyPressed
       if (evt.getKeyCode() == KeyEvent.VK_ENTER)
           login();/*from w  w  w  .j  av a  2s  .c  om*/
   }

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();/*w ww.j a v a  2  s .c o m*/
            } catch (IOException ex) {
                Logger.getLogger(GUIClient.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

}