Results 1 to 2 of 2
- 04-14-2012, 10:39 PM #1
Unsure of whether to use key bindings
My app has two text input components, a terminal and a chat window. Right now I'm using key listeners so that whichever component has focus receives key typed events. This works, but it's potentially a little confusing if neither component has focus.
So what I'd like is for the chat window to receive key events when it has focus, and the terminal to receive key events when it or anything else other than the chat window has focus.
Can I do this with key bindings? I've never used them directly (I understand they're used for accelerators and mnemonics and stuff like that) and I'm a little confused about them. Is there an easy way to set up key bindings for "any key", or would I need to create a binding for every key I want my terminal to accept?Get in the habit of using standard Java naming conventions!
- 04-15-2012, 07:33 AM #2
Re: Unsure of whether to use key bindings
There are three input maps. Judicious selection (and experimenting) should get you what you want.
Is there an easy way to set up key bindings for "any key"
or would I need to create a binding for every key I want my terminal to accept?
Last edited by DarrylBurke; 04-15-2012 at 07:45 AM.If you're forever cleaning cobwebs, it's time to get rid of the spiders.
- By gib65 in forum AWT / SwingReplies: 2Last Post: 10-14-2010, 04:44 PM
- By babe20042004 in forum New To JavaReplies: 1Last Post: 04-01-2010, 05:14 PM
- By Stipejava in forum NetBeansReplies: 0Last Post: 10-30-2009, 01:15 PM
- By dbashby in forum New To JavaReplies: 7Last Post: 04-16-2009, 05:49 AM
- By levent in forum Java SoftwareReplies: 0Last Post: 05-24-2007, 10:12 AM