com.gluonhq.charm.glisten.control.TextField does not exist

吃可爱长大的小学妹 提交于 2019-12-07 15:29:12

问题


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.


回答1:


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:

http://docs.gluonhq.com/charm/javadoc/4.3.5/index.html?com/gluonhq/charm/glisten/control/TextField.html




回答2:


This TextField is a product of Gluon which needs the external library. It will cause such exceptions, if you do not intend to use.

The control below is builtin TextField.




回答3:


head over to GluonHQ and download charm.glisten....jar and import it in your libraries of the Javafx package in netbeans.. it worked for me



来源:https://stackoverflow.com/questions/43760039/com-gluonhq-charm-glisten-control-textfield-does-not-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!