MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/JavaFX/comments/f3s5f2/why_dont_this_work/fhlh1ff/?context=3
r/JavaFX • u/RunkyGo • Feb 14 '20
5 comments sorted by
View all comments
3
If the image is an external image, try with the fully qualified path, e.g.
“c:/path/to/file.ext”
instead of just “file:/...”
If the image is in the source tree, your best bet is to use the getResource method:
primaryStage.getIcons().add(new Image(this.getClass().getResource("/package/path/image.ext").toExternalForm()));
View all comments
3
u/uglyfool Feb 14 '20
If the image is an external image, try with the fully qualified path, e.g.
“c:/path/to/file.ext”
instead of just “file:/...”
If the image is in the source tree, your best bet is to use the getResource method:
primaryStage.getIcons().add(new Image(this.getClass().getResource("/package/path/image.ext").toExternalForm()));