Answers for "javafx fxmlloader location is not set"

0

javafx fxmlloader location is not set

//CHECK THE FULL ANSWER BUT THIS MIGHT BE A QUICK FIX
 //DON'T USE .. IN THE PATH
 
 // FXML file in the same package as the current class:
 URL fxmlURL = getClass().getResource("MyFile.fxml");
 Parent root = FXMLLoader.load(fxmlURL);

 // FXML file in a subpackage called `fxml`:
 URL fxmlURL2 = getClass().getResource("fxml/MyFile.fxml");
 Parent root2 = FXMLLoader.load(fxmlURL2);

 // Similarly for images:
 URL imageURL = getClass().getResource("myimages/image.png");
 Image image = new Image(imageURL.toExternalForm());
Posted by: Guest on May-11-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language