I am developing one JavaFX application. GUI is in .fxml file. Trying to load .fxml file in BlueJ IDE, but not able to load. But The same code working properly in Eclipse IDE. When I load Non-BlueJ JavaFX project (which is Eclipse project), it loads all .java and .css files, but not .fxml file. I written in Eclipse IDE, But I have to run it in BlueJ IDE. what to do now? can I convert this .fxml into .java code? if yes, how? or is there any other way?
Asked
Active
Viewed 445 times
0
-
I don't see why BlueJ would function much differently than any other IDE, but I've never used it. See if this helps at all: [How do I determine the correct path for FXML files, CSS files, Images, and other resources needed by my JavaFX Application?](https://stackoverflow.com/questions/61531317/). – Slaw Jan 25 '21 at 22:17
-
Hi James Z. Did you worked on BlueJ??? – Siddu Jan 26 '21 at 06:44
-
Thank you Slaw for your comment – Siddu Jan 26 '21 at 13:43
1 Answers
1
.fxml files will not be shown in BlueJ IDE, but can be loaded at Run time by specifying the path. To load .fxml file in BlueJ, you have to add src at beginning of path of the .fxml file.
In Main.java
Parent root=FXMLLoader.load(getClass().getClassLoader().getResource("src/application/FutoshikiGUI.fxml"));
You must specify(Edit) or add src to your Controller class Path in FXML file also
In FXML File
<VBox alignment="TOP_CENTER" maxHeight="600.0" maxWidth="500.0"
minHeight="600.0" minWidth="500.0" prefHeight="591.0" prefWidth="500.0"
spacing="1.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1"
**fx:controller="src.application.FutoshikiGUIController**">
Above lines are helpful when you are loading Eclipse JavaFX project into BlueJ IDE

Siddu
- 77
- 1
- 8