How to get the enter key function in multiple jbutton??
hi friend To bind the key with the JButton in Java you will have to use the getInputMap() method of JComponent and put() method of InputMap
button = new JButton("Press Enter "); button.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put (KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "Enter");
As well as to map action to this button you will have to use
getActionMap() and put() method of ActionMap
For detail description go through the link given below
can this be used in netbeans??