aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark ""Hot keys in Swings -- URGENT"" Watch ""Hot keys in Swings -- URGENT"" New topic
Author

"Hot keys in Swings -- URGENT"

Raghavendra_Singh
Greenhorn

Joined: Sep 20, 2001
Posts: 2
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.
Ana Mihailescu
Greenhorn

Joined: Apr 26, 2001
Posts: 29
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "Hot keys in Swings -- URGENT"
 
Similar Threads
SET A BUTTON AS "DEFAULT"
doClick and trapping of enter key
Regarding Listener
META_KEY
How to set Default button in Swing