Re: Antwort: Intercepting keystrokes in plugin
Posted by
dscho on
Jul 22, 2009; 10:02am
URL: http://imagej.273.s1.nabble.com/Intercepting-keystrokes-in-plugin-tp3691678p3691682.html
Hi,
On Wed, 22 Jul 2009, Joachim Wesner wrote:
> you mean, your plugin kets the keys as it should be, but it will ALSO be
> handled by ImageJ?
>
> I´m not sure, which happens first, just did a quick internet search, there
> is a
>
> KeyEvent.consume
>
> methods, which marks an event as already fully handled, you might give
> it a try!?
That relies on your KeyListener being called first, which is not good.
Better to removeKeyListener(IJ.getInstance()) on the ImageWindow to
prevent ImageJ from handling the keys at all.
You can then hand off the event (if it is not handled yet) to
IJ.getInstance().keyPressed().
Ciao,
Dscho