Basically I have a JavaFX app with main window that eventually creates other JFrames. In my Application subclass I register a JNativeHook so I receive keyboard input, but I want to perform actions upon it only in the window/frame that has focus/is on the top.
Currently I am using focus events and store a static hasFocusedInstance on each window's class, but it does not seem to work 100%. Is there a good way to do this? I do not wanna use KeyBinds/KeyEventListeners for they are unreliable.