Which workable menu layout editor can be used for creation of menus for JME3?

I didn’t find enough information how to create menu layouts with a comfortable GUI. I have been using LibGDX before which have a separate tool for menu creation (because LibGDX doesn’t contain own SDK – it is only set of libraries). Only using my watchfulness, I found a small button “Visual” between “XML” and “History” when I create a new clear UI and open it in the SDK.
If I right understood, I need to press this button to enable a visual editor (correct if I wrong understood the idea). But the SDK shows an error, which was already published somewhere in this forum:

java.lang.IllegalStateException: Cannot instantiate com.jme3.gde.gui.view.NiftyGuiVisualElement
    at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:439)
    at org.netbeans.core.multiview.MultiViewModel.getElementForDescription(MultiViewModel.java:197)
    at org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:107)
    at org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:103)
    at org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:445)
    at org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:437)
    at org.netbeans.core.multiview.MultiViewPeer$SelectionListener.selectionChanged(MultiViewPeer.java:904)
    at org.netbeans.core.multiview.MultiViewModel.fireSelectionChanged(MultiViewModel.java:234)
    at org.netbeans.core.multiview.MultiViewModel.setActiveDescription(MultiViewModel.java:95)
    at org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:297)
    at java.desktop/javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:356)
    at java.desktop/javax.swing.ButtonGroup.setSelected(ButtonGroup.java:168)
    at org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:293)
    at org.netbeans.core.multiview.TabsComponent$ButtonMouseListener.mousePressed(TabsComponent.java:885)
    at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:288)
    at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:287)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6618)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3398)
    at java.desktop/java.awt.Component.processEvent(Component.java:6386)
    at java.desktop/java.awt.Container.processEvent(Container.java:2266)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4996)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4828)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4572)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4828)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:775)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:98)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.NoSuchMethodException: com.jme3.gde.gui.view.NiftyGuiVisualElement.<init>()
    at java.base/java.lang.Class.getConstructor0(Class.java:3761)
    at java.base/java.lang.Class.getConstructor(Class.java:2442)
    at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:425)
    ... 46 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
    at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.createElement(MultiViewFactory.java:422)
    ... 46 more
Caused by: java.lang.NoSuchMethodError: 'void de.lessvoid.nifty.builder.PopupBuilder.childLayoutAbsolute()'
    at jada.ngeditor.model.utils.NiftyDDManager.<init>(NiftyDDManager.java:32)
    at jada.ngeditor.guiviews.J2DNiftyView.init(J2DNiftyView.java:154)
    at com.jme3.gde.gui.view.NiftyGuiVisualElement.<init>(NiftyGuiVisualElement.java:125)
    at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
    ... 49 more

One more interesting thing is that I have also tried to create a new clear project inside the SDK and selected Lemur (not Nifty) for the UI. But when I try to add a new empty GUI – I receive the same XML-layout as before in my previous NiftyGUI project and same error, when I press “Visual”. Does it mean – Lemur is not available for editing also?

Are there other methods to create simple static menus without manual XML-editing? Maybe third-party tools?

Visual and XML GUI editing is only for Nifty. And for that you need to go back a few versions of the SDK to get it working.

As far as I understand, there are no visual editors for other GUIs. Or at least public ones. But there are plenty of GUI libraries available to use with jME. So there is a chance though…

The issue: Nifty GUI editor crashes on launch · Issue #276 · jMonkeyEngine/sdk · GitHub

@tonihele If I right understood I need to play with older versions of the SDK to find the version, which doesn’t crush by opening the visual GUI-editor. Do you have an information which version of the SDK should be used to avoid this issue?
What about Lemur? Does it use also XML format and have no visual editor?

Well, if past me is to be trusted, you need to go all the way back to Release JME sdk 3.0.10 · jMonkeyEngine/sdk · GitHub. jME 3.0 based SDK.

But it also might be easier for you just to use the actual editor than to use super old jME SDK. GitHub - relu91/niftyeditor: Create your game gui with nifty-editor and nifty-gui.

Lemur doesn’t use XML. Only Nifty does. As far as I know, Lemur does not have a visual editor. There are also bigger UI libraries available, non jME specific ones, that can be used. They might actually have a bigger ecosystem that includes visual editors if that is your deal breaker.

1 Like

@tonihele Thanks, the first launch if the NiftyEditor on Windows 10 failed with an error:

C:\Software\JME3>java -jar Nifty-Editor.jar >out.txt
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
        at jada.ngeditor.NiftyEditor.main(NiftyEditor.java:71)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 1 more

C:\Software\JME3>

… but I will try to do something. Maybe I’ll install SDK 3.0.10

You can create a bug in the Github for relu91. Quite possible you need older Java to run that.

Edit: yep, quick Google confirms by suspicions. Try Java 8.

@tonihele I think the project is abandoned - there are so many loosed libraries, so many not more outside visible methods and other problems. Java 8 can not eliminate all the errors.

Most of things related to Nifty are abandoned. There is near zero chance that it will have a new release ever. There are some active forks yes.

You can even use my fork:

Although should you choose Nifty, you should either use it as is or fork mine or any other forks. As my fork is not guaranteed to serve everybody’s needs. It is basically for my own projects, and that is the most promise I can make for its future development.

2 Likes

Nifty is very much abandoned. Im sure some people still find it useful but most people have moved on. I personally used to use it but hated its API and migrated off it.

Lemur is laid out in java (not xml or visual editor) and is much more widely used and better maintained.

Supporting a visual editor usually means making some fairly horrible design choices that mean programatic laying out is much worse.

1 Like

If Lemur supported an XML layout then it would a 10x more verbose version of what is already available in Java. So no one has implemented that.

To make a functional menu in Lemur with 5 items in it is about 6 lines of code, one to create the menu and one each for each menu item.

An example in the most concise form that just calls methods on the local object:

Container myMenu = new Container();
// Do a thing where the method name closely matches the displayed text
myMenu.addChild(new ActionButton(new CallMethodAction(this, "thingOne")));
// Do a thing where the method name does not match the displayed text
myMenu.addChild(new ActionButton(new CallMethodAction("Do Something" this, "somethingElse")));
// A button that will need some special behavior not already provided by ActionButton
Button custom = myMenu.addChild(new Button("Custom"));

The look and feel is controlled with styling. To any of those GUI elements, ElementIds can be added that are associated with specific styling:

Container myMenu = new Container(new ElementId("menu.container"));
// Do a thing where the method name closely matches the displayed text
myMenu.addChild(new ActionButton(new CallMethodAction(this, "thingOne")));
// Do a thing where the method name does not match the displayed text
myMenu.addChild(new ActionButton(new CallMethodAction("Do Something" this, "somethingElse"), new ElementId("special.button")));
// A button that will need some special behavior not already provided by ActionButton
Button custom = myMenu.addChild(new Button("Custom"));

So a “menu.container” could have special borders/backgrounds. A “special.button” could have different styling, and so on.

2 Likes

@tonihele your fork is workable, thanks. I found a way to launch the examples but I don’t understand how to launch the GUI-editor. Is it possible or it is only a set of separate examples?

I have also installed the old version of the SDK (3.0.10 from your link). I never seen how the visual editor of JME3 must work, but I have received only a blank window area. Maybe it is normal:

If It is possible,I want to remember that I can not launch any OpenGL subwindow inside the SDK (I wrote about this here: my previous problem. Maybe the GUI-editor works normal but I can not watch him because it uses OpenGL inside the JDK.

@richtea if I right understood Lemur is a project which doesn’t hard attached to JME3 and is developed separate from JME3 and I can try to find some separate GUI-editors on Github and forget to try to search only by keywords: “gui editor for lemur JME3”.

I’m pretty sure Lemur doesn’t have one [visual editor], I would have assumed pspeed, the author, would know about it and he would’ve already told about one. For Nifty, there is only the renderer implemented in jME. Nothing else, Nifty is a separate project. So is Lemur and all the others. jME doesn’t really have an internal GUI system.

For troubleshooting the Nifty editor itself.. well. I don’t know when I have time to try. Here is at least a video tutorial for it: https://www.youtube.com/watch?v=O0rdFwRVYbE. It is the same editor whether you just got it from the guy’s repo or manage to run through the SDK.

Someone seemed to have managed to run it through a modern SDK even Fix SDK Nifty Gui Editor. Perhaps the SDK could also force the Nifty 1.4.1 as a dependency, I assume only Ant projects would suffer from this if any…

1 Like