A week or two ago, Eskil wrote a blog about how he'd been working on mixing AWT and Qt together in the same window. At the time he'd gotten to the point where we could embed a Qt widget inside an AWT component. Now we've gotten a bit further...
Based on the same approach we used for the Qt inside AWT embedding, we could also do the other way around pretty easy. The result is something along the lines of:
As opposed to Eskil, I decided to not show the picture of us with flowers in our hair that we took in San Francisco when we went for JavaOne earlier this year... What you're seeing here is a QWidget with a grid layout with two QWidgets on the left, a QTextEdit with an html page and the CollidingMice example. On the right is the SwingSet demo. We also tried to embed a Java3D example there and that worked equally well.
The solution is not completely there yet, though. I did spend a day trying to get the focus handling between the two libraries right, and it was surprisingly non-trivial. AWT for instance doesn't pass on the information that you're doing SHIFT-Tab to do backwards traversal of the focus chain, so you need to figure that out based on the component that lost focus and where it is relative to the current one in the focus chain, and so forth... Lots of fun things. Right now its at a state where it works most of the time, but through mouse clicks and back/forward tabbing it breaks after a while so there is still work to be done.
The other issues are window activation, as we're actually embedding the window natively and while the AWT component has focus, Qt becomes inactive, etc, but I'm not sure we'll be able to get around that one. The other issue is OS X where AWT and Qt Jambi cannot run in parallel because of the Carbon event system not being thread safe.
Right now the code to get this example running looks something like this: