Problem SimpleGame and Java Swing GUI

In my project, I create a SimpleGame window from a swing gui. After creating the window, the GUI is not accessible, i.e. I can't click on the buttons of my GUI or can't traverse through menu items.



I know other solutions exist, like using a headless application or StandardGame, but I wrote about 600 lines of code and it will be difficult for me to switch to something else.



So any ideas how I can get those swing GUI buttons and menus working when the SimpleGame is running?



And if one can guarantee me I won't live this problem with FengGUI, I can move from swing to it.

Are you using the absolute mouse then??



If you are, you may need to override the update method; thats where the cursor bounds are checked/repositioned inside the graphics window.



Admins: would it be possible to have a boolean flag? true if mouse should be locked inside bounds, false for no-lock.

I don’t use absolute mouse, I just use hardware mouse, it is possible to get out of the SimpleGame window with it, but the problem is using swing componens with it.



And I am not using that kind of lock since I need to be able to get out of the SimpleGame window, what I am trying to tell is something like that:







The swing component beyond the game window isn’t clickable or traversable or whatever. How can I make them work?

can you show how and when in swing, you create and start the SimepleGame?

Sure, in the menu, choosing Algorithm -> Hill, a panel comes up like below:







then pressing OK, the SimpleGame is created with the code:


private void generateHillTerrain(){
        if(callWithSeed) new HillAlgorithm(hsize, hiter, hminr, hmaxr, hflat, hseed, callWithSeed);
        else new HillAlgorithm(hsize, hiter, hminr, hmaxr, hflat, callWithSeed);
    }



HillAlgorithm is simply a class I've written to call the jme's Hill implementation, it includes some other features I use in the SimpleGame application. A heightmap is generated, then this heightmap is used within terrainPage, then it is attached to root node.

HillAlgorithm extends a class called AbstractTerrain (again the class I've implemented) and AbstractTerrain extends SimpleGame...

Have you tried running your swing UI on a different thread than Jme??

No didnt do that, I guess I am gonna use JMEDesktop instead…

you can still start a jME-SimpleGame from a Swing app, but you need to run jme in a Separate Thread, so your Swing application is not blocked.



I think you want to do something like:


         public void actionPerformed(ActionEvent arg0) {
            Runnable run = new Runnable() {
               @Override
               public void run() {
                  new TestAxisRods().start();
               }
            };
                                run.run();
         }


It is good i know that, I will try that if I cant cope with JDesktop.



Thanks!