GBUI Problems

I have spent all day trying to find a decent way to implement GUI into JME.



FengGUI seems to not be ready to work with JME, apparently it needs a different LWJGL and fixing, plus it doesnt compile right in my eclipse



JMEDesktop has all kinds of crazy memory leaks, causing my computer to use hundreads of MBs of memory to run it after a short amount of time.



and finally, GBUI, which is the one I want to go with, but I keep getting problems. I have the project all properly set up in eclipse, but when I try to integrate it into eclipse, I continually keep getting the error

java.lang.VerifyError: class com.jmex.bui.PolledRootNode overrides final method findCollisions.(Lcom/jme/scene/Spatial;Lcom/jme/intersection/CollisionResults;)V



Well, I might just be doing something wrong. Basically, what I would really appreciate is if someone could drop me a helloworld class for GBUI that uses something besides their BaseTest. For some reason, even when using their basetest outside of the GBUI project I get that error, even when I am using their exact same class source from the Test folder!

Well, any help would be appreciated. Thanks!

i would recommend you follow the instructions for setting up gbui in eclipse that are here;



http://code.google.com/p/gbui/wiki/CreatingYourJmeInterfaceUsingGbui1



worked fine for me last week…

ok, well I made the necessary changes (installed groovy, which I am confused about what it does) and removed the jars referring to JME and replaced the lwgjl file and set up its natives.



But I am now getting build errors and these build errors refer to the same errors I was getting before pertaining to pooledrootnode and canvas rootnode





I have 4 errors in my GBUI project, 2 in canvasrootnode.java and 2 in pooledrootnode.java



All 4 errors are the same: "Cannot override the final method from Spatial"



I can go into spacial and take off the final modifer, but what will that do to JME?

I need help please.


  1. you shouldn't need Groovy unless you're going to use it for the tests
  2. did you download the jar from the site?  If so, you'll need to svn the trunk tip…the error you're getting is from an update to JME 2.0 and has been fixed on the trunk tip.


I downloaded GBUI from a svn link from google code.

(http://gbui.googlecode.com/svn/trunk/)

The link I used was from a few months ago that was saved on my SVN websites list.



What is this trunk tip?  is it the entire GBUI Project + a fix? or is it just a fix that I incorporate into my already installed GBUI?



Also, what is the SVN for the trunk tip so that I can download it?



Thanks for all the help!

Hi. I have been looking into this all evening.



My files BRootNode.java, CanvasRootNode.java and PolledRootNode.java are all up to date with the latest ones on the SVN link in the post above. So, I am confused as to how you fixed these problems because they are not fixed on the SVN.



I also checked the latest issues and the problem I am experiencing doesnt seem to be on there.



Under fixes, it seems to note my problem and that it was fixed,

on Sep 02, removed final methods

but I have the same code as those classes, so was the problem really fixed?

I am confused what I am doing wrong here.

Reminds me of my own problem which I had with JME Physics!

At one point (couple of weeks ago), they changed some things in JME core and implemented some stuff about collisions. JME Physics stopped working and I got almost the same error as you get (smth about findCollisions cannot be overridden, because it is final now). Anyway, I reported the problem, and they fixed it (in JME Physics).

So I think you should wait a little, for GBUI authors to see this post and patch things up. :slight_smile:

there were two fixes

one was on 02Sep09, which I did to remove the final methods

the fix was implemented on 09Sep09 by mr simpson to fix compile errors caused by the recent changes to jME



Schizofera has been working to clean up the jars.  However, if you have the trunk tip (the HEAD) and add all of the jars except the "jme-" jars (e.g. jme-font, jme-audio, etc) then you should have no issues.



I compile it daily.

Well.



I downloaded the latest JME 2 from Google Code as of Sep 29. This did not fix the problem. The GBUI is as of Sep 27.



Attached are the jars in my GBUI build path, also in that build path is the JME2 project.

I am sorry but I am at a loss, I have the latest projects, and the problem is still existing. Also, I am pretty sure I followed that tutorial to the letter, so I dont see whats going wrong.



but, thanks for all the help in solving this, I appreciate it.

I can't really help you with eclipse, I don't use it.



your project is missing the jme_2.0.jar file which is in the lib directory.



other than that, it looks right.  Can you post all of your stack trace?

EDIT: Apparently with the combination of adding jME2.0.jar and using the new source, this solved the problem. Thanks so much for the help!







sorry for this misunderstanding, I am fairly fresh to all of this, where can I find the stack trace?



Also… I added you to MSN messenger I believe, so we can discuss there which I feel would be quick, and we can post the outcome here when the problem is solved.





If this is what you are talking about, I tried to run ErrorDialogueBoxTest.java



this is what prints out in the console

java.lang.VerifyError: class com.jmex.bui.PolledRootNode overrides final method findCollisions.(Lcom/jme/scene/Spatial;Lcom/jme/intersection/CollisionResults;)V
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
   at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
   at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Exception in thread "main"

Ok, actually, here is what is happening…



so I have set up GBUI so that I can properly run the test inside of that project.



Now, when I try to run anything in an outside project I get that same error still:

java.lang.VerifyError: class com.jmex.bui.PolledRootNode overrides final method findCollisions.(Lcom/jme/scene/Spatial;Lcom/jme/intersection/CollisionResults;)V



I even get that error when I try to run SimpleBGUITest.java in an outside environment. However, inside of the GBUI project, the SimpleBGUITest.java works! I think this has something to do with my build paths. What I have done is after the tests inside of GBUI started working, I ran the build.xml with compile(all) and dist on.

I then incorporate this jar file into the outside projects that I am trying to run outside GBUI tests with. I have also tried running GBUI project through the build path as well and neither of these have worked. So, I am at a loss again as to what I am doing wrong.
Thanks for any help.


//EDIT: Main solution to my problem which was emailed to standtrooper:
"So, I did testing, lots of testing. I knew it had to do with the build path, so thats mainly what I focused on.

For an external project, what the build path consisted of was:

Projects:
JME2
JME Physics
GBUI

Library's:
JRE System Library[jdk1.6]
ODEJava (odejava-jnl.jar) - the physics jar
and my JME2 Required Library - (all jars from jme's lib folders) and this library also had jme-bui.jar

so, to me it seemed like I had a solid build path, but from testing, i discovered that by removing my JME2 Required Library, it solved my polledrootnode problem."

Just thought I would share this with the community, to help people get up to speed faster. Seeing as it took so much time for me to get here today, here is some code to run GBUI inside of Gamestates using StandardGame and basicgamestatenode.



This is a combination of many peoples code and tutorials, and is the culmination of my knowledge on these topics in a basic sense so that new people can understand it and begin to work off of it.



I hope someone finds it useful.





State Manager

package Main;


import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jmex.game.StandardGame;
import com.jmex.game.state.GameStateManager;

public class RunGame {
   
   public static StandardGame statemanager;
   //public static game gamestate;
   public static main_menu mainmenustate;
   //public static ingamemenu ingamemenustate;
   //public static lobby lobbystate;
   //public static lobbymenu lobbymenustate;
   
   public RunGame(){
      // initiate the main game, which is running off standard game
      statemanager = new StandardGame("JMonkey Game ");
      statemanager.getSettings().setSFX(false);
      statemanager.getSettings().setMusic(false);
      statemanager.getSettings().setWidth(800);
      statemanager.getSettings().setHeight(600);
      statemanager.getSettings().setFullscreen(false);
      statemanager.getSettings().setStencilBits(4);
      statemanager.start();
      
      // initiate the different states
      //gamestate = new game("gs");
      mainmenustate = new main_menu("Main Menu");      
      // Activate the game state   
      mainmenustate.setActive(true);
      //gamestate.setActive(true);
      // Add it to the manager
      //GameStateManager.getInstance().attachChild(gamestate);   
      GameStateManager.getInstance().attachChild(mainmenustate);


   }

   
   public static void main(String[] args)
   {
      RunGame m = new RunGame();
   }

}



Main Menu

package Main;

import java.util.concurrent.Callable;

import com.jme.input.InputHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.MouseInput;
import com.jme.system.DisplaySystem;
import com.jme.util.GameTaskQueueManager;
import com.jme.util.Timer;
import com.jmex.bui.BButton;
import com.jmex.bui.BDecoratedWindow;
import com.jmex.bui.BWindow;
import com.jmex.bui.BuiSystem;
import com.jmex.bui.PolledRootNode;
import com.jmex.bui.event.ActionEvent;
import com.jmex.bui.event.ActionListener;
import com.jmex.bui.layout.TableLayout;
import com.jmex.game.state.BasicGameStateNode;

public class main_menu extends BasicGameStateNode{
   
    protected InputHandler input = new InputHandler(); 

   BWindow window;

   public main_menu(String name) {
      super(name);
      
      // show mouse cursor
      MouseInput.get().setCursorVisible(true);
        BuiSystem.init(new PolledRootNode(Timer.getTimer(), input), "/rsrc/style2.bss");

      //initiates game stuff, in this case the main menu
      initgame();

   }

   public void update(float tpf) {
      super.update(tpf);

      if (KeyBindingManager.getKeyBindingManager().isValidCommand("Exit"))
      {
          System.exit(0);
      }

   }
   
   
   private void initgame() {
       
      
      // init GBUI       
        window = new BDecoratedWindow(BuiSystem.getStyle(), null);
        TableLayout layout = new TableLayout(1, 10, 0);
        layout.setEqualRows(true);
        layout.setHorizontalAlignment(TableLayout.STRETCH);
        window.setLayoutManager(layout);
        BuiSystem.addWindow(window);
        window.setSize(250,  DisplaySystem.getDisplaySystem().getRenderer().getHeight()/ 2);

        // the exit Button, calls BaseGame.quit() when executed
        final BButton btnExit = new BButton("Exit");
        btnExit.addListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
           RunGame.statemanager.finish();
        }                     
        });

      try {
         GameTaskQueueManager.getManager().update(new Callable<Object>() {
            public Object call() throws Exception {               
                 window.add(btnExit);
               window.center();
               BuiSystem.addWindow(window);
               return null;
            }
         });
      } catch (Exception e) {
         e.printStackTrace();
      }
        rootNode.attachChild(BuiSystem.getRootNode());

      
   }



}

Awesome!  Congrats on finding the issue and fixing it!

I am having 1 more problem.


BuiSystem.init(new PolledRootNode(Timer.getTimer(), input), "path");



cant see anything new I add.

For example, with the link "/rsrc/style2.bss" my program runs just fine.

I copied style2.bss and named it ctf.bss.
after doing this, changing the link to "/rsrc/ctf.bss" returns null pointer exceptions.

Also, if I copy the rsrc folder, put it in my personal project, and rename it, i still get null pointer exceptions, even if i put the new folder I made directly into the classpath.

Do you guys have any ideas what might be causing this?

while, again, I can't speak for eclipse…I always put the rsrc information into a jar and add that directly to my classpath

well, apparently my project isnt recieving its style2.bss from my GBUI projects rsrc folder, because i just changed an attribute of button to make it load a different image and the change didnt take effect.



Also, apparently it isnt comming from build/rsrc/ because changes made in there also dont take effect.



Also, if I make changes in either of them and then run build.xml with dist and compile(default) both on, it doesnt recognize changes either. So if build.xml writes to rsrc.jar, then it isnt getting information from rsrc.jar either.



So if it isnt comming from either rsrc folder, or rsrc.jar, than where is the file path "/rsrc/style2.bss" referring to? because that is where i need to go edit information.



Also, can GBUI work with tables and include Bbuttons into a table?

And, also, how can I center objects like Bbuttons, or align them to the top, right, bottom, etc?



Thanks!

if your rsrc.jar is in your path then that's where the information is coming from.  Whether or not the build.xml actually creates the rsrc.jar I don't think it does.  I'll add that to the list of things to do.  I just jar up the rsrc directory and add it to the classpath.



Tables, buttons, etc, yes it can and there are several examples in the test directory

Centering and alignment isn't generally done by a bss or coding change, but by adding a layout manager to a particular portion then setting your buttons to a particular BorderLayout direction.