File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: "Hot keys in Swings -- URGENT"