Login  Register

Re: KeyListener problem

Posted by Kenneth Sloan-2 on Mar 18, 2020; 3:12pm
URL: http://imagej.273.s1.nabble.com/KeyListener-problem-tp5023044p5023056.html

Thank you!

I made the following changes:
...
   @Override
        public void keyPressed(KeyEvent e)
    {
        IJ.log("keyPressed");
        keyCode = e.getKeyCode();
        keyChar = e.getKeyChar();
        modifiers = e.getModifiers();
        IJ.log("   "+keyCode+"   "+keyChar+"   "+modifiers);
        synchronized(this)
            {
                IJ.log("notifying");
                notify();
                IJ.log("notified");
            }
    }
...

        while(true)
            {
                synchronized(this)
                    {
                        IJ.log("waiting...");
                        wait(); // keyPressed wakes us
                        IJ.log("woken up!");
                    }
                // key pressed!
...

and it's fine (on my machine...which is less than informative, but at least I didn't break anything).  Shipping now for the "client" to test.

Again - thank you for the prompt and useful reply.
--
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