I looked through similar questions. But as I do not understand, I address in a separate question. Thank you for your reply.

    2 answers 2

    Well, you need to dig towards the KeyListener interface. Here is a good example of how it works http://java-lang.at.ua/publ/obrabotka_sobytij/keylistener_obrabotka_sobytij_klaviatury/2-1-0-4

    Well, for example:

    JPanel panel = new JPanel(); panel.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if(e.getKeyCode() == 10){ //10 - ΠΊΠΎΠ΄ клавиши Enter // ΠΊΠ°ΠΊΠΎΠΉ-Ρ‚ΠΎ ΠΊΠΎΠ΄, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ Π΄ΠΎΠ»ΠΆΠ΅Π½ Π²Ρ‹ΠΏΠΎΠ»Π½ΠΈΡ‚ΡŒΡΡ } } }); 

      you need to assign a default button, which just works when you press enter

       JButton enter = new JButton(); JRootPane rootPane = SwingUtilities.getRootPane(enter); rootPane.setDefaultButton(enter);