• 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

How to make buttons react to keyboard (Hotkey functionality)

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm developing a chat client and I need to know how I can have my "send" button work when the "Enter" key is pressed on the keybaord. It would be annoying to have to move the mouse everytime and click on "send" for some text to be sent; it is much easier to press Enter key on keyboard instead. I know a little about event handling. If there is a tutorial somewhere or you can provide me with a quick piece of code I would appreciate it vert much.
-Thank you
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try something like this:

inside the JFrame/JDialog code where this refers to the JFrame / JDialog/ JWindow.

Tanveer
[ July 27, 2004: Message edited by: Tanveer Rameez ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic