I spent some time figuring out how to get Swing components to show correctly in my scenegraph, with correct translations and scale. Last time I showed you that I could include Swing components in my scene, but that scaling them only scaled their bounds. Their contents remained at the same size.
Well, I got that fixed (be sure to compare this to the screenshot from the previous post):
The solution involves installing a custom RepaintManager, and doing some AWTEvent capturing and forwarding. It's all very tedious, but once it works it's quite fun to see the effect. There still seem to be some imperfections, but most of the components I tried (I tried several of varying complexity, though by no means all) now work as expected. Even when scaled.
The result is that I can now leverage the existing Swing components in my scene, without having to reinvent them.
No comments:
Post a Comment