hi all, I have a panel made in swings.It contains certain buttons , on click of which certain actions(backend processing takes place)are triggered (one row is updated in the database at one click). Now since my catalog which has to be UPDATED contain thousands or records , each time pressing a button THROUGH MOUSE is obviously very taxing. In order to do away with it I have added a Keylistener to the button and now on pressing a key on keyboard say "control"(essentially triggers the same events as triggered by clicking the button with mouse)I get what I want. But for that the button has to be brought into focus to using tab. CAN U SUGGEST SOME METHOD SO THAT I CAN COMPLETELY DO AWAY WITH THE BUTTON AND CAN PERFORM THE SAME OPERATIONS ON PRESS OF A KEY ON KEYBOARD.
If I have right understood your problem , the solution is to set the 'Mnemonic' for your JButtons. for example : javax.swing.JButton button; button.setText("abcdefg"); button.setMnemonic('c'); The result is that the 'c'letter on your button is underlined and the actions that are triggered by a click on the button will be triggered in the same way by ALT - c from the keyboard