I'm having difficulty creating a text input field so a player can enter his name. I am using the jme-bui11.jar. I keep getting a null pointer exception.
Exception in thread "main" java.lang.NullPointerException
at java.io.Reader.<init>(Unknown Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at com.jmex.bui.bss.BStyleSheetUtil.readFile(BStyleSheetUtil.java:67)
at com.jmex.bui.bss.BStyleSheetUtil.readFile(BStyleSheetUtil.java:60)
at com.jmex.bui.bss.BStyleSheetUtil.loadMultipleBSS(BStyleSheetUtil.java:197)
at com.jmex.bui.bss.BStyleSheetUtil.getStyleSheet(BStyleSheetUtil.java:125)
at com.jmex.bui.BuiSystem.init(BuiSystem.java:98)
at com.fox.eldertale.client.states.LoginState.<init>(LoginState.java:36)
at com.fox.eldertale.client.ElderTaleClient.<init>(ElderTaleClient.java:18)
at com.fox.eldertale.client.ElderTaleClient.main(ElderTaleClient.java:50)
Thanks for pointing that out. I've added the bss file to the class path and get passed that error but now I receive this error:
WARNING: Child operation choked[op=com.jmex.bui.BContainer$2@1b06041, child=com.jmex.bui.BTextField@7f5580].
java.lang.NullPointerException
at com.jmex.bui.BTextField.recreateGlyphs(BTextField.java:383)
at com.jmex.bui.BTextField.wasAdded(BTextField.java:280)
at com.jmex.bui.BContainer$2.apply(BContainer.java:323)
at com.jmex.bui.BContainer.applyOperation(BContainer.java:393)
at com.jmex.bui.BContainer.wasAdded(BContainer.java:321)
at com.jmex.bui.BWindow.setRootNode(BWindow.java:228)
at com.jmex.bui.BRootNode.addWindow(BRootNode.java:105)
at com.jmex.bui.BRootNode.addWindow(BRootNode.java:65)
at com.jmex.bui.BuiSystem.addWindow(BuiSystem.java:226)
at com.fox.eldertale.client.states.LoginState.createWindows(LoginState.java:60)
at com.fox.eldertale.client.states.LoginState$1.call(LoginState.java:41)
at com.jme.util.GameTask.invoke(GameTask.java:101)
at com.jme.util.GameTaskQueue.execute(GameTaskQueue.java:115)
at com.jmex.game.StandardGame.update(StandardGame.java:320)
at com.jmex.game.StandardGame.run(StandardGame.java:198)
at java.lang.Thread.run(Unknown Source)
Exception in thread "main" java.lang.NullPointerException
at com.fox.eldertale.client.ElderTaleClient.<init>(ElderTaleClient.java:43)
at com.fox.eldertale.client.ElderTaleClient.main(ElderTaleClient.java:50)
May 12, 2008 10:00:53 PM class com.jme.util.GameTask invoke()
SEVERE: Exception
java.lang.NullPointerException
at com.jmex.bui.BTextField.computePreferredSize(BTextField.java:346)
at com.jmex.bui.BComponent.getPreferredSize(BComponent.java:178)
at com.jmex.bui.layout.GroupLayout.computeChildDimens(GroupLayout.java:325)
at com.jmex.bui.layout.GroupLayout.computeDimens(GroupLayout.java:302)
at com.jmex.bui.layout.VGroupLayout.layoutContainer(VGroupLayout.java:80)
at com.jmex.bui.BContainer.layout(BContainer.java:290)
at com.jmex.bui.BContainer.validate(BContainer.java:268)
at com.jmex.bui.BWindow.setRootNode(BWindow.java:232)
at com.jmex.bui.BRootNode.addWindow(BRootNode.java:105)
at com.jmex.bui.BRootNode.addWindow(BRootNode.java:65)
at com.jmex.bui.BuiSystem.addWindow(BuiSystem.java:226)
at com.fox.eldertale.client.states.LoginState.createWindows(LoginState.java:60)
at com.fox.eldertale.client.states.LoginState$1.call(LoginState.java:41)
at com.jme.util.GameTask.invoke(GameTask.java:101)
at com.jme.util.GameTaskQueue.execute(GameTaskQueue.java:115)
at com.jmex.game.StandardGame.update(StandardGame.java:320)
at com.jmex.game.StandardGame.run(StandardGame.java:198)
at java.lang.Thread.run(Unknown Source)
Does this error imply something wrong with the bss file? I am using the same ones in the svn rsrc folder until I get more familiar with the library.
Actually I've found that I can't instantiate any of the controls except BWindow which I can get to show up now, I am getting a NoSuchMethodError on BImage. Perhaps I am using GBUI incorrectly. Do you happen to have a really basic StandardGame example for GBUI? Something that just displays a text field or button?
Also, I was using an older GBUI jar that was not working well with the JME version my project was using. After the advice I was getting no such method errors when GBUI was making calls on the JME library. The solution to that problem was to build the latest GBUI from SVN.
I'm still having a lot of trouble with this. I built the latest version from the svn repository.
I make sure to call everything in the OpenGL thread, but once I try to add any sort of text, - either the text doesn't display at all, or I get the following stack trace:
Jun 13, 2008 2:57:36 PM com.jmex.game.DefaultUncaughtExceptionHandler uncaughtException
SEVERE: Main game loop broken by uncaught exception
org.lwjgl.opengl.OpenGLException: Invalid value (1281)
at org.lwjgl.opengl.Util.checkGLError(Util.java:50)
at org.lwjgl.opengl.Display.swapBuffers(Display.java:606)
at org.lwjgl.opengl.Display.update(Display.java:625)
at com.jme.renderer.lwjgl.LWJGLRenderer.displayBackBuffer(Unknown Source)
at com.jmex.game.StandardGame.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Help would be appreciated, BUI looks promising and well documented. I'm using an Intel integrated graphics chip, which I've heard has some trouble with some OpenGL calls...and I've also heard OpenGLException 1281 to be caused by textures which aren't 2^n in dimensions.