Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+11 votes

When I click the Add Movie button, it crashes with this error:

 Caused by: javafx.fxml.LoadException: 
at javafx.fxml@18/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2707)
Caused by: java.lang.ClassNotFoundException: com.gluonhq.charm.glisten.control.TextField
asked in CSC305 Fall 2022 by (1 point)

3 Answers

+8 votes

Yeah, you don't want to use anything from the com.gluonhq package -- those are special Gluon controls that can be used to create mobile apps. (Gluon is the company that makes the SceneBuilder software, and they sell their mobile app library/tools to developers).

We just want to use the regular JavaFX controls -- so, what went wrong?

When building your scene in SceneBuilder, you should have used the TextField control under the regular "Controls" category, instead of the TextField control that's under the Gluon category. (Yes, it's very confusing that there are two widgets both named the same thing!) If you look closely, you'll see that the Gluon controls are tinted blue, whereas the regular controls are just gray.

To fix this, go back to SceneBuilder, and delete the Gluon TextField, and replace it with a regular Textfield. (But also, make sure to set the fxid of your new TextField to titleTextField)

answered by (508 points)
+7 votes

It worked for me after choosing the other text field option under the controls.

answered by (1 point)
+6 votes

I do not think you actually need that line to run the lab. It had an error on mine as well and deleting it seemed to fix the problem.

answered by (1 point)