Hellp all,
I have been having issues trying to setup a Style_Map.
I read up first we needed to change to gui.xml from .xml, so I have changed that. I also read that we need to clean/build but that didn’t really do anything.
First time that I got it without telling me it couldn’t find it, I got a nullpointer, with a bunch of stuff about devices array not being able to be updated.
in the initialize part of my appstate I call
this.screen = new Screen(app, "Interface/style_map.gui.xml");
My style_map.gui.xml
<?xml version="1.0" encoding="UTF-8"?><style control="Button" path="Interface/button.gui.xml" />
my button.gui.xml is an exact copy of the button.xml here Google Code Archive - Long-term storage for Google Code Project Hosting.
So after running it with my path as
/Interface
I get
May 29, 2015 2:26:22 AM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at tonegod.gui.core.Screen.(Screen.java:268)
at mygame.GameScreenAppState.initialize(GameScreenAppState.java:43)
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:251)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:281)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:239)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)
However, I tried changing it from /Interface to just “Interface” (Saw another post with it as just that), and got a similar error to what I got before my Clean/Build.
May 29, 2015 2:26:33 AM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at tonegod.gui.core.Screen.(Screen.java:268)
at mygame.GameScreenAppState.initialize(GameScreenAppState.java:43)
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:251)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:281)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:239)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)
java.lang.InternalError: Could not update the devices array.
at sun.awt.windows.WToolkit.eventLoop(Native Method)
at sun.awt.windows.WToolkit.run(WToolkit.java:299)
at java.lang.Thread.run(Thread.java:722)
Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsException: 0
at sun.awt.Win32GraphicsEnvironment.getDefaultScreenDevice(Win32GraphicsEnvironment.java:96)
at sun.font.FontDesignMetrics.getDefaultFrc(FontDesignMetrics.java:153)
at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:278)
at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1012)
at javax.swing.JComponent.getFontMetrics(JComponent.java:1624)
at javax.swing.plaf.basic.BasicGraphicsUtils.getPreferredButtonSize(BasicGraphicsUtils.java:276)
at javax.swing.plaf.basic.BasicButtonUI.getPreferredSize(BasicButtonUI.java:376)
at javax.swing.plaf.basic.BasicButtonUI.getMinimumSize(BasicButtonUI.java:366)
at javax.swing.JComponent.getMinimumSize(JComponent.java:1742)
at javax.swing.plaf.basic.BasicOptionPaneUI.addButtonComponents(BasicOptionPaneUI.java:692)
at javax.swing.plaf.basic.BasicOptionPaneUI.createButtonArea(BasicOptionPaneUI.java:630)
at javax.swing.plaf.basic.BasicOptionPaneUI.installComponents(BasicOptionPaneUI.java:178)
at javax.swing.plaf.basic.BasicOptionPaneUI.installUI(BasicOptionPaneUI.java:141)
at javax.swing.JComponent.setUI(JComponent.java:664)
at javax.swing.JOptionPane.setUI(JOptionPane.java:1861)
at javax.swing.JOptionPane.updateUI(JOptionPane.java:1883)
at javax.swing.JOptionPane.(JOptionPane.java:1846)
at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:858)
at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:667)
at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:638)
at com.jme3.system.JmeDesktopSystem$1.run(JmeDesktopSystem.java:93)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Exception in thread “AWT-EventQueue-0” java.lang.ArrayIndexOutOfBoundsException: 0
at sun.awt.Win32GraphicsEnvironment.getDefaultScreenDevice(Win32GraphicsEnvironment.java:96)
at sun.awt.windows.WToolkit.resetGC(WToolkit.java:136)
at sun.awt.Win32GraphicsEnvironment.displayChanged(Win32GraphicsEnvironment.java:192)
at sun.awt.windows.WToolkit$3.run(WToolkit.java:758)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Exception in thread “AWT-Windows” BUILD SUCCESSFUL (total time: 6 seconds)
After doing another Clean/Build the second error changed back into the first, so I guess the second is a Clean/Build issue, but not too sure why I’m having a nullpointer?
Thoughts?
Also is there a way to setup styles without a “Style_map?” It seems redundant if you have only 1 style to call it in another file…It seems to be a good way to organize all of your styles, but is it fully needed? It seems the Screen needs to call it, but can you call the “button” style from your “button?” or does it all have to go through the Screen class? It seems you can change individual styles with individual controls though, depending on the situation.
Thanks all…