Slick steals keyboard focus from swing

Now, I know slick was made for awt and that TWL is available among other things, but I want to try this with swing if it’s possible to do. So, I’m trying to come up with a way around this and I haven’t gotten any working solutions yet. So I’ll explain the problem.

When I start my swing application all works fine. As soon as the CanvasGameContainer (the slick component) gets focus (i.e. clicking on it), I can no longer type in any text fields in the swing portion of my application. I tried adding a mouse listener for when I click on the text field to request focus but it doesn’t seem to work. Does anyone know of a work around for this?

Here’s my current code (though I took out a lot to simplify it).

http://privatepaste.com/bc0f37e652

Well, nevermind I just did an extremely hacked together work around. I’ve noticed this question being asked many places on the web with not real answer, so I’ll post my code here. It basically channels the input between the swing and slick components based on a boolean “inputFocused” that changes depending on mouse clicks.

Code:
http://privatepaste.com/91f2188a70

Use Pastebin! It takes forever to scroll down! :o

Mahbad :stuck_out_tongue: Fixed it.
Hmm, not too shabby.

http://nubcraft.org/stuff/nub0.png