Skip to content

JavaFX Image (class) and ImageView with a URL

I know how to use Image with a url there was a good example here

However, when I input a URL into the string it doesn’t work although the Javadocs say if it not a URL it will try to find the file. But it is a URL and its just not displaying.

All that has been changed is
CustomImage item_2 = new CustomImage(new ImageView(new Image("url:https://pictureOfCat")));



CustomImage item_2 = new CustomImage(new ImageView(new Image("http://pictureOfCat")));

The issue is “https” when I changed it to “http” it worked fine! And removing “url:”

So @Vyacheslav Zhukov had the right idea though! – I didn’t think https would make a difference.

User contributions licensed under: CC BY-SA
3 People found this is helpful