java - My KeyEvents don't get registered while the Timer is firing events. How to fix this? -


java noob here. in application class, have jpanel focusable set true , keylistener class added it. have timer registered timerlistener class set in application's main function. keyevents work, once press jbutton call timer.start(), keyevents stop firing , timer's actionperformed executes. when timer.stop() gets called, keyevents still don't work. know i've set wrong, can't figure out how fix it. can help?

but once press jbutton call timer.start(), keyevents stop firing , timer's actionperformed executes.

keyevents passed component focus.

if click on button, has focus, not panel.

try resetting focus on panel in button actionlistener code.

or better solution use key bindings. can set key bindings action still invoked when focus on panel or component on panel.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -