sshahine / JFoenix

JavaFX Material Design Library
MIT License
6.27k stars 1.05k forks source link

Exceptions throw when trying to use JFXTextField in Scenebuilder 16 #1218

Open ghost opened 2 years ago

ghost commented 2 years ago

Trying to use in scenebuilder and the jar analysis report includes this:

Exception for: com/jfoenix/controls/FakeFocusJFXTextField.class
javafx.fxml.LoadException: 
unknown path:2
    at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.constructValue(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml/javafx.fxml.FXMLLoader.load(Unknown Source)
    at com.oracle.javafx.scenebuilder.kit.library.util.ExplorerBase.instantiateWithFXMLLoader(ExplorerBase.java:56)
    at com.oracle.javafx.scenebuilder.kit.library.util.ExplorerBase.exploreEntry(ExplorerBase.java:111)
    at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.exploreEntry(JarExplorer.java:83)
    at com.oracle.javafx.scenebuilder.kit.library.util.JarExplorer.explore(JarExplorer.java:65)
    at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.exploreAndUpdateLibrary(LibraryFolderWatcher.java:367)
    at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.runDiscovery(LibraryFolderWatcher.java:155)
    at com.oracle.javafx.scenebuilder.kit.library.user.LibraryFolderWatcher.run(LibraryFolderWatcher.java:100)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalAccessException: class javafx.fxml.FXMLLoader$InstanceDeclarationElement (in module javafx.fxml) cannot access a member of class com.jfoenix.controls.FakeFocusJFXTextField with modifiers ""
    at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Unknown Source)
    at java.base/java.lang.reflect.AccessibleObject.checkAccess(Unknown Source)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
    at java.base/java.lang.reflect.ReflectAccess.newInstance(Unknown Source)
    at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source)
    at java.base/java.lang.Class.newInstance(Unknown Source)
    ... 13 more
CTaszus commented 2 years ago

Not a fix but helps maybe: I had other problems using Scene Builder 16 and switched back to 15.

elegantShock2258 commented 2 years ago

This is a problem with scenebuilder, you have to downgrade.

louhy commented 2 years ago

What I tend to do when SceneBuilder doesn't support a custom component is create and initialize those components in code instead of FXML... not ideal but it does let you continue to use SB for other stuff.

CTaszus commented 2 years ago

Sometimes, SB is missing a library for a custom component. I think SB cannot resolve dependencies. My SOP is:

  1. Make sure a zero-argument-constructor exists
  2. Check any static and default constructor lines against uncommon objects

Edit: But as I wrote above this is a different problem. For this thread, a SB downgrade should to the job.