Results 1 to 3 of 3
- 11-26-2012, 02:22 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 41
- Rep Power
- 0
registering KeyEvents on a JComponent
How do I add a key listener to a JComponent? The documentation seems to indicate that KeyListeners can only be on certain kinds of components like JTextArea and the like, bu tIm trying to implement a drawing program and would like ctrl+z functionality, and I need the component all the drawing is happening on to register key events.
- 11-26-2012, 02:54 PM #2
Member
- Join Date
- Oct 2011
- Posts
- 41
- Rep Power
- 0
Re: registering KeyEvents on a JComponent
never mind, i did more research and apparently the way to go is an input map? is this correct?
- 11-26-2012, 05:20 PM #3
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,605
- Rep Power
- 5
Re: registering KeyEvents on a JComponent
The following gives a pretty clear demo for how to do this: How to Use Key Bindings (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Other Swing Features)
Similar Threads
-
Key press not registering as ENTER
By trader5050 in forum New To JavaReplies: 2Last Post: 07-15-2011, 09:43 PM -
Command not registering.
By Kuetsum in forum New To JavaReplies: 3Last Post: 01-18-2011, 07:19 AM -
Using JComponent methods on a JComponent that was found using .getComponents()
By tashimoto in forum New To JavaReplies: 2Last Post: 10-01-2010, 07:18 PM -
Multiple email greetings on registering.
By MadJack in forum Suggestions & FeedbackReplies: 0Last Post: 09-26-2010, 11:05 PM -
Registering problem
By trini32 in forum New To JavaReplies: 1Last Post: 06-25-2009, 04:35 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks