Swing interface inputproblems

Hey folks,
I’m currently programming an editor that is inside of a Swing application.
When going into a JFormattedTextField Object, I can’t enter any values until i change to a different window (for example Firefox) and back again.
When then going into the application i have to then select the left JPanel (which is the interface) and can then edit the TextField.
As soon as i do anything in the right JPanel (Jmonkeyengine) i can’t edit the Textfield of the left Pannel anymore… (of corse until i change windows again)

Thanks for any Help
Its really appreciated!

additional Information:
I think, that probably the actionlistener in the jmonkeyengine app gets all the input and therefore it can’t be used in the interface but i don’t know how to fix this.
Is there a way to pause the actionListener? I don’t even know if this would solve the InputProblem .
Is there a way to switch the input from one pannel to another?

Yeah, the SimpleApplication “eats” your key input :slight_smile:
I don’t have a solution for that problem, but I guess your JFormattedTextField is placed in the same Frame as your SceneApplication? What if you put it into a separate JDialog? You could make one window displaying the 3D-Scene and 1 with the tools (GIMP-Style).
BTW is swing the only option for you?
If not, try the Nifty GUI, or t0neg0d’s GUI …

Thanks for that fast answer
I will try to create a JDialog which has all JFormattedTextFields and stuff.
Would be pretty cool if it works, but its still allot of work because i will have to change huge parts of the structure of the Programm.

So if anyone knows how to stop the jme3 application from eating up the input pls let me know.
Thanks for the help!

There;s been a few threads discussing this in the past but I don’t think anyone’s come up with a good solution.

For anyone interrested (can spare you allot of time if you have the same Problem):
In a Swing application allways one component has the Focus -> to prevent that input eating of the jme3 InputSystem yout have to change the Focus away from the component
(my Code for getting the Component of the Canvas from my Application)
JmeCanvasContext ctx = (JmeCanvasContext) ca.getContext();
Component ctxSC = (Component) ctx.getCanvas();
functions for switching the focus:
to change focus when needed away from Canvas:
read mousposition -> is mousposition outside Canvas (if yes ) -> ctxSC.transferFocusBackward();
(i only transfer Focus backward when the mouse has been outside the canvas for a certain time (verry slow functions)

than in any slider etc that changes the canvas and you need to see the change straight away ! -> ctxSC.requestFocus(); (focus changes back and therefore the Canvas displays the change but while the mouse is outside the canvas it automaticly changes the focus back)

and voila …
should be pretty easy for you to solve this Problem now



You are a magician !!!

Thanks so much, it works like a charm now, at last.

1 Like

glad i could help :stuck_out_tongue_winking_eye: