1

While trying to open FXML file in SceneBuilder, exception is thrown. Is there a way to fix this?

Java:
11.0.19 2023-04-18 LTS

SceneBuilder:
Version 20.0.0
Date: 2023-05-08 14:08:52
JavaFX Version: 20.0.1
Java Version: 20, OpenJDK Runtime Environment

JFoenix:
jfoenix-8.0.10.jar
jfoenix-9.0.10.jar
jfoenix-17.0.2.jar
jfoenix-17.0.5.jar
jfoenix-19.0.1.jar
(none of above is working)


java.lang.NullPointerException: Cannot invoke "javafx.scene.Node.getLayoutBounds()" because "this.textNode" is null
    at com.jfoenix.skins.JFXTextFieldSkin.updateTextPos(JFXTextFieldSkin.java:109)
    at com.jfoenix.skins.JFXTextFieldSkin.layoutChildren(JFXTextFieldSkin.java:93)
    at javafx.controls@20.0.1/javafx.scene.control.Control.layoutChildren(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.SubScene.layoutPass(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Group.prefWidth(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Group.minWidth(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.layout.Region.computeChildPrefAreaWidth(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.layout.Region.getMaxAreaWidth(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.layout.Region.computeMaxPrefAreaWidth(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.layout.StackPane.computePrefWidth(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.prefWidth(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.layout.Region.prefWidth(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.layout.Region.minWidth(Unknown Source)
    at javafx.controls@20.0.1/javafx.scene.control.skin.ScrollPaneSkin.computeScrollNodeSize(Unknown Source)
    at javafx.controls@20.0.1/javafx.scene.control.skin.ScrollPaneSkin.layoutChildren(Unknown Source)
    at javafx.controls@20.0.1/javafx.scene.control.Control.layoutChildren(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Parent.layout(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Scene.doLayoutPass(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Scene.preferredSize(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Scene$2.preferredSize(Unknown Source)
    at javafx.graphics@20.0.1/com.sun.javafx.scene.SceneHelper.preferredSize(Unknown Source)
    at javafx.graphics@20.0.1/javafx.stage.Window$12.invalidated(Unknown Source)
    at javafx.base@20.0.1/javafx.beans.property.BooleanPropertyBase.markInvalid(Unknown Source)
    at javafx.base@20.0.1/javafx.beans.property.BooleanPropertyBase.set(Unknown Source)
    at javafx.graphics@20.0.1/javafx.stage.Window.setShowing(Unknown Source)
    at javafx.graphics@20.0.1/javafx.stage.Window.show(Unknown Source)
    at javafx.graphics@20.0.1/javafx.stage.Stage.show(Unknown Source)
    at com.oracle.javafx.scenebuilder.kit.editor.panel.util.AbstractWindowController.openWindow(AbstractWindowController.java:152)
    at com.oracle.javafx.scenebuilder.app.DocumentWindowController.openWindow(DocumentWindowController.java:1228)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.performOpenFiles(SceneBuilderApp.java:675)
    at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleOpenFilesAction(SceneBuilderApp.java:513)
    at com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController.handleOpen(WelcomeDialogWindowController.java:221)
    at com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController.fireOpenRecentProject(WelcomeDialogWindowController.java:194)
    at com.oracle.javafx.scenebuilder.app.welcomedialog.WelcomeDialogWindowController.lambda$loadAndPopulateRecentItemsInBackground$2(WelcomeDialogWindowController.java:155)
    at javafx.base@20.0.1/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at javafx.base@20.0.1/javafx.event.Event.fireEvent(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Node.fireEvent(Unknown Source)
    at javafx.controls@20.0.1/javafx.scene.control.Button.fire(Unknown Source)
    at javafx.controls@20.0.1/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Unknown Source)
    at javafx.controls@20.0.1/com.sun.javafx.scene.control.inputmap.InputMap.handle(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at javafx.base@20.0.1/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at javafx.base@20.0.1/javafx.event.Event.fireEvent(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Scene$MouseHandler.process(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Scene.processMouseEvent(Unknown Source)
    at javafx.graphics@20.0.1/javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
    at javafx.graphics@20.0.1/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at javafx.graphics@20.0.1/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at javafx.graphics@20.0.1/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(Unknown Source)
    at javafx.graphics@20.0.1/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)
    at javafx.graphics@20.0.1/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
    at javafx.graphics@20.0.1/com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
    at javafx.graphics@20.0.1/com.sun.glass.ui.View.notifyMouse(Unknown Source)
    at javafx.graphics@20.0.1/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics@20.0.1/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
horvoje
  • 643
  • 6
  • 21
  • Where is `this.textNode`? That is where your issue lies. – SedJ601 Aug 09 '23 at 16:22
  • @jewelsea I have hundreds od FXML files already made and they are using JFoenix components. Does it mean I have to replace them all? The app is in production and deployed to many customers which puts me on risk to do such large changes. – horvoje Aug 10 '23 at 07:42
  • @SedJ601 Well, I don't know where is it because I only try to open (F) XML file and that file does not have any Java code inside. Ok, I could use sources, put a breakpoint and find where the issue is by myself, but before I tried here to see if anyone else knows more than me. – horvoje Aug 10 '23 at 07:45
  • 1
    @jewelsea Oh, lucky me haha! Tnx! – horvoje Aug 10 '23 at 07:49
  • Moved prior comments to an answer. – jewelsea Aug 11 '23 at 22:19

1 Answers1

0

Advice

Use MaterialFX instead.

Some JFoenix components are known to be broken in recent SceneBuilder builds and, also, when using JavaFX versions > 15.

Explanation

The stack trace shows an error arising in the JFoenix code, not your code.

https://github.com/bisq-network/bisq/pull/5835:

Running the desktop app only works on JDKs 11 through 15 until sshahine/JFoenix#1205 is fixed. Right now, attempting to run on JDK 16+ will result in a Cannot invoke "javafx.scene.Node.getLayoutBounds()" because "this.textNode" is null error.

Can I still use JFoenix

Maybe try the solution here:

which is to downgrade to JavaFX 15 both for your runtime and also to downgrade to an earlier version of SceneBuilder that runs on JavaFX 15.

You will need to try various archived versions from Gluon if they have them to find one that runs on JavaFX 15 or earlier as all the later SceneBuilder versions use JavaFX 17+ or later which does not work with JFoenix.

FAQ

I have hundreds of FXML files already made and they are using JFoenix components. Does it mean I have to replace them all? The app is in production and deployed to many customers which puts me on risk to do such large changes.

Well that is difficult then. Probably you will need to change your work flow to hand edit some of the fxml files in a text editor rather than SceneBuilder. Some IDEs, like Idea offer intelligent editing support for that which can help.

Over time, if you want to continue to maintain the app rather than freezing it as is or retiring it, then plan to migrate from JFoenix to MaterialFX.

Can I debug this issue in a debugger?

A breakpoint won’t help unless you run SceneBuilder and the JFoenix code in a debugger, which I really wouldn’t recommend.

Can I fix the JFoenix library?

You could perhaps from the stack trace work out where the error and incompatibility in the JFoenix code is and then fix it in a custom version of the JFoenix library. But, it isn’t the only control incompatible with recent scene builder versions. You might have to patch and fix multiple things in JFoenix.

Currently I don't think the JFoenix repository is active, so requests for support might not be actioned (that may change over time).

jewelsea
  • 150,031
  • 14
  • 366
  • 406