2016-10-22 60 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