• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

"Hot keys in Swings -- URGENT"

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic