JavaFX Image (class) and ImageView with a URL

Tags: , ,



I know how to use Image with a url there was a good example here
https://stackoverflow.com/a/24934324/7159163

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")));

Answer

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.



Source: stackoverflow