Closed EasyG0ing1 closed 2 years ago
Updated the PR which leaves the original setGraphic
method intact, and instead, I added two overloaded methods:
setGraphic(File file, int iconWidth, int iconHeight)
setGraphic(String URLString, int iconWidth, int iconHeight)
Which allow passing in a file object or a String of the URL along with desired width and height.
I have significantly changed this pull request, so I am closing it and opening a different one.
The updateGraphic(File file) method when used with Java 18, throws an exception, because when loading a JavaFX Image from a file path, it has to be preceded with the word "file:" - and I can't remember if that is also true of Java 1.8, but I tend to think it's not.
So I updated the method to catch the error if it's thrown, then it will prepend the path to the file with "file:" and then it loads the image and keeps moving along...
Tested it in GistFX and it works properly.