0
我目前正在從Facebook FQL拉取圖片的網址,並且希望將此圖片放在標籤中。我已經嘗試了以下,但我得到下面的錯誤。請幫忙。將圖片插入到帶有網址的javafx中的標籤
CODE:
String facebook_Post_Url;
Image facebook_Image = new Image(facebook_Post_Url, 700, 0, false, false);
facebook_Label.setGraphic(facebook_Image);
錯誤:
error: incompatible types: Image cannot be converted to Node divider1_Label.setGraphic(facebook_Image);
更新:
我現在嘗試下面的代碼,但仍然得到錯誤
ImageView facebook_Image = new ImageView(new Image(getClass().getResourceAsStream("https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-prn2/s720x720/1508634_699393523428883_996610253_n.png")));
divider1_Label.setGraphic(facebook_Image);
錯誤:
Unexpected error java.lang.NullPointerException: Input stream must not be null
注:ImageViewBuilder現在已經過時。 – 5120bee