I can't control key events in JWindows.
What should I do ?
Martin Gregorie - 22 Jul 2006 23:16 GMT
> I can't control key events in JWindows.
> What should I do ?
Type more carefully and a lot slower? :-)
Do you mean "how do I capture key events that Swing/awt is eating"?
If so you need to create a key handler by extending KeyAdapter. You
probably only need to override the keyTyped method, which should
extract the keypress from the event and send it to your model.
Instantiate the key handler in your JWindow constructor and call
addKeyListener() (inherited from java.awt.Component) to install it.

Signature
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
Andrew Thompson - 22 Jul 2006 23:29 GMT
> I can't control key events in JWindows.
Have you tried using (or threatening) capital punishment?
That often scares key events into line.
> What should I do ?
1. Post some (very short) compilable example of
your code that does not work.
2. Ensure you setFocusable(true) and requestFocus()
on the JWindow or its main component.
3. If 2. fails, ..see 1.
Andrew T.