I'm using scene builder to create an user interface which uses com.gluonhq.charm.glisten.control.TextField
. It works properly in the Scene Builder and it's preview.
But in the NetBeans editor I get the class does not exist error.
When I try to run the application, I get the following runtime error.
Caused by: java.lang.ClassNotFoundException: com.gluonhq.charm.glisten.control.TextField
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at javafx.fxml.FXMLLoader.loadTypeForPackage(FXMLLoader.java:2916)
at javafx.fxml.FXMLLoader.loadType(FXMLLoader.java:2905)
at javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2846)
... 60 more
I used the Library manager in Scene Builder to install com.gluonhq:charm
repository. But I still get those errors. Any suggestion will be highly appreciated.
you can download the repo from: http://nexus.gluonhq.com/nexus/content/repositories/releases/com/gluonhq/charm-glisten/4.4.1/
If you add this as a library in your JavaFX application and reference it with an import in the FXMLDocumentController:
import com.gluonhq.charm.glisten.control.ProgressBar;
import com.gluonhq.charm.glisten.control.ProgressIndicator;
import com.gluonhq.charm.glisten.control.TextField;
And ofcourse the link to the FXML file:
@FXML
private ProgressIndicator progress;
@FXML
private ProgressBar progressbar;
@FXML
private TextField textfield;
in the FXML file:
<?import com.gluonhq.charm.glisten.control.ProgressBar?>
<?import com.gluonhq.charm.glisten.control.ProgressIndicator?>
<?import com.gluonhq.charm.glisten.control.TextField?>
and do not forget to set the fx:id:
<ProgressIndicator fx:id="progress" layoutX="85.0" layoutY="14.0" opacity="0.75" prefHeight="132.0" prefWidth="137.0" progress="0.25" radius="75.0" />
<ProgressBar fx:id="progressbar" layoutX="16.0" layoutY="177.0" opacity="0.75" prefHeight="18.0" prefWidth="288.0" progress="0.75" />
<TextField fx:id="textfield" layoutX="118.0" layoutY="80.0" prefHeight="27.0" prefWidth="92.0" />
It should work (works fine with me =^)
see for more info:
前往GluonHQ并下载 Charm.glisten....jar 并将其导入到您在 netbeans 中的 Javafx 包的库中..它对我有用
Just download charm-glisten JAR file here: https://nexus.gluonhq.com/nexus/content/repositories/releases/com/gluonhq/charm-glisten/
go to the latest version
for exemple:
charm-glisten-6.0.2.jar
in 6.0.2 version under https://nexus.gluonhq.com/nexus/content/repositories/releases/com/gluonhq/charm-glisten/6.0.2/
Try to add scenebuilder-xxx-all.jar to libraries of your project (it works for me). In windows you find it in the setup former in C, but in Linux you have to search for it :
只需删除它并导入它对我有用
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.