Reputation: 472
I have a dependency Jar with some FXML files that I would like to use, how can I reference it?
URL location = getClass().getResource("?????????.fxml");
fxmlLoader.setResources(ResourceBundle.getBundle("messages", Locale.getDefault()));
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Upvotes: 0
Views: 1026
Reputation: 160
Region root = FXMLLoader.load(getClass().getResource("FILE.fxml"));
final FILEJAVA filejava = new FILEJAVA(stage, root);
or
BorderPane pane = null;
try {
pane = (BorderPane) FXMLLoader.load(FILEJAVA.class.getResource("FILE.fxml"));
pane.getStyleClass().add("main");
} catch (IOException ex) {
Logger.getLogger(FILEJAVA.class.getName()).log(Level.SEVERE, null, ex);
System.exit(-1);
}
Upvotes: 1