Setting focus using keystroke outside of the Swing thread

Yeah. I know. It might sound a little nutty. But I have a TextArea that holds my in game chat. I want the player to be able to scroll up and down that chat using pg up and pg down even if the TextArea is not in focus. My idea is just to requestFocus if one of those keys are pressed. The problem is I can't do this in the Swing thread (I don't think) because I want it work no matter what has focus.



Ok. So In my main thread, I setup a couple of key listeners through the standard KeyBindingManager. And in update I do this:


      if (KeyBindingManager.getKeyBindingManager().isValidCommand(
            "ScrollChatDown", false)) {
         Runnable doWorkRunnable = new Runnable() {
         

Most focus stuff is switched off in JMEDesktop to allow proper functioning (as it hides a JFrame that should never gain focus). The only way to focus something in JMEDesktop is by calling myDesktop.setFocusOwner( component ). That's why e.g. Tab to change focus does not work.

Cool beans. That did the trick. Thanks again.