I want to add an application icon to my program. I've tried to do that as following, but it haven't worked:
primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("lock.png")));
primaryStage.getIcons().add(new Image(Controller.class.getResourceAsStream("lock.png")));
final Parent root = FXMLLoader.load(getClass().getResource("passwordGenerator.fxml"));
or
primaryStage.getIcons().add(new Image("lock.png"));
Also I tried to do that without a FXML
file and it worked.
How can I add an application Icon with a FXML
file?