Jmoonkey niftygui visual error

  1. I create new empty gui
  2. click on visual
  3. have errorjava.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:346)
    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:6629)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
    at java.desktop/java.awt.Component.processEvent(Component.java:6397)
    at java.desktop/java.awt.Container.processEvent(Container.java:2263)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4544)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    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.()
    at java.base/java.lang.Class.getConstructor0(Class.java:3349)
    at java.base/java.lang.Class.getConstructor(Class.java:2151)
    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.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    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.(NiftyDDManager.java:32)
    at jada.ngeditor.guiviews.J2DNiftyView.init(J2DNiftyView.java:154)
    at com.jme3.gde.gui.view.NiftyGuiVisualElement.(NiftyGuiVisualElement.java:125)
    … 51 more

Are you just getting started with your UI or do you otherwise have a strong reason to want to use niftygui?

No i dont have reason to use niftygui

suggest an alternative?

Lemur is very popular. (Full disclosure, I’m also the author.)

And a lot easier to use than niftygui.

2 Likes

The Lemur demos project is a bunch of examples/tests wrapped in a launcher. After the getting started documentation, it can be a good way to get your bearings.

How to add Guava to jmonkey project if i use simple (not gradle) project?

Thanks.
How to add groovy to jmonkey project?
can’t find jar

Here’d a link to the last version I download the jar for a while back. Its not the latest but should work.

https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all/2.4.12

Not that it matters much anymore, but the OPs problem is this known issue: Nifty GUI editor crashes on launch · Issue #276 · jMonkeyEngine/sdk · GitHub

1 Like

As an alternative to using a visual editor (since unfortunately Nifty’s is broken and Lemur doesn’t have one) you might find it worthwhile to design your project and interface code in a way that you can easily launch only the menus to reduce the load time when you need to run the app to see how the GUI is looking.

For example when I’m working on menus, I change one line of code early in my app’s initiation process and then the the app instantly loads nothing but the menu I’m currently working on when I run it. So the result is almost the same as having a visual viewer.

Who use gradle project?
tell me how to write dependencies for lemur

Strings for:
Guava
slf4j
Groovy

work

plugins {
    id 'java'
    id 'application'
}

group 'com.mygame'
version '1.0'

sourceCompatibility = 1.8
mainClassName = "com.mygame.Main"

repositories {
    jcenter()
}

project.ext {
  jmeVer = '3.5.1-stable'
}

project(":assets") {
    apply plugin: "java"
    
    buildDir = rootProject.file("build/assets")

    sourceSets {
        main {
            resources {
                srcDir '.'
            }
        }
    }
}

dependencies {

  implementation "org.jmonkeyengine:jme3-core:$jmeVer"
  implementation "org.jmonkeyengine:jme3-desktop:$jmeVer"
  implementation "org.jmonkeyengine:jme3-lwjgl:$jmeVer"
  
  implementation "org.jmonkeyengine:jme3-plugins:$jmeVer"
  
    // We definitely want a UI
    compile "com.simsilica:lemur:1.13.0"
    compile "com.simsilica:lemur-proto:1.11.0"

    // And our base code for sim-etheral, SiO2, etc.
    // (many of these need to be built locally and 'gradle install'ed as of this writing)

    compile 'com.google.guava:guava:19.0'
    compile 'org.slf4j:slf4j-api:1.7.13'
    runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.5'
    
    implementation 'org.apache.logging.log4j:log4j-api:2.8.2'
    implementation 'org.apache.logging.log4j:log4j-core:2.8.2'
    implementation 'org.codehaus.groovy:groovy-all:2.4.15'

    
}

jar {
    manifest {
        attributes 'Main-Class': "$mainClassName"
    }
}

A tool I’ve found very useful for “I want dependency X, what’s it’s gradle name” is https://mvnrepository.com/repos/central

Ignore the fact it has mvn in its name, it works for both maven, gradle and others