User input event consumed even after switch back from SimpleApplication canvas

Hi guys,

I integrated SimpleApplication canvas with my Swing application by adding canvas into a second tab (in JTabbedPane). Switch tab from first to second works fine. The canvas displays 3D models greatly. However, after some user inputs (like mouse drag, W/A/S/D, etc), I switch tab back to the first tab and try to enter values into text fields but nothing happens. I tried to enter W and it does seem the Canvas still consume key event (as the camera did move forward when I switch back to canvas tab).

The only workaround is deactivate application window (by clicking somewhere else on my desktop) and back, everything is fine. So I assume I may miss some calls to switch focus manually but I tried firstTabComponent.requestFocus() no luck :frowning:

Did someone have same issue before?


After some investigations, I found tab switch wouldn’t call SimpleApplication gain/lose focus so the input manager keeping consuming events. Manually call gainFocus()/loseFocus() when tab is switching doesn’t work :frowning: