2016-10-22 59 views

回答

4

如果鏈接提供了有效的圖片,則您可以使用作爲圖片圖標。下面的代碼可以在實現你想要什麼

SwingUtilities.invokeLater(new Runnable() { 
     public void run() {    
       String fullUrlPath = "your image path"; 
       try { 
        URL url = new URL(fullUrlPath); 
        BufferedImage img = ImageIO.read(url); 
        ImageIcon icon = new ImageIcon(img); 
        JOptionPane.showMessageDialog(null, icon); 
       } catch (MalformedURLException e) { 
        e.printStackTrace(); 
       } catch (IOException e) { 
        e.printStackTrace(); 
       }     
     } 
     }); 
+0

感謝您的評論 –

+0

感謝您的評論 你的答案被清除了事情的一半有用的,另一半則是如何獲得鏈接的API是專爲JavaScript –

+2

@GhassenTounsi你可以使用java包裝的api像jInstagram。或者你可以自己寫。 – Selim