Important: At the moment we use a nasty hack to make event system work: Set dispatcher field of Container class with reflection. ... However we beleive event system can also be made work with a custom Toolkit and a dummy Peer. Indeed we seek help from AWT/Swing gurus about this subject.I think this shows that the Sun programmers did not make the Swing library with re-usability in mind, they have designed the swing library to be used on the event dispatch thread only.
I was waiting to see what @KevenWorkman replied first, but there's probably another hacky (but less hacky than above!) way of doing this, without going as far as creating a new Toolkit - run the main game loop on the (well, an*) EDT. The EventQueue will give you access to events which you can filter and dispatch as you like.
* Stupidest threading decision in AWT / Swing is blocking threads and pushing a new EDT / EventQueue when a modal Dialog opens! The above suggestion would break if a Dialog opened.
takes sole control of the operating system (OS) event queue in its event dispatch thread (EDT), forcing us to do all of our work on the EDT or making us do messy invokeAndWait's all the time.
Which is still doing the work on the EDT - invokeAndWait() - the ideal way to make hard to find bugs - there's a reason they left it out of JavaFX!