Re: KeyListener problem
Posted by
Kenneth Sloan-2 on
Mar 18, 2020; 4:52pm
URL: http://imagej.273.s1.nabble.com/KeyListener-problem-tp5023044p5023059.html
No joy. The improved(?) version exhibits the same problem. Now on two machines (but not yet on mine). The symptoms are that no KeyPresses are registered AT ALL. Note that there is a call to IJ.log at the start of keyPressed() - so this is not an issue with wait/notify. I'm glad I cleaned that up - but it wasn't the problem.
It appears as if the KeyListeners are not being registered. Is there a way to double check that a given class has been successfully registered as a KeyListener?
It also occurs to me that there might be a race condition here:
ipl.show();
win = ipl.getWindow();
canvas = win.getCanvas();
Is it possible that win and canvas may not yet be set, because ipl.show() takes some time to complete? Should I add something like "wait(1000)" after the ipl.show()"? Is there a direct way to check that ipl.show() has finished all of its work before proceeding?
For example...will this help?
...
ipl.show();
ImageWindow win = null;
while(null == win) {win = ipl.getWindow();}
...
--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html