I want to get JOptionPane to open up images from a link, because I have an assignment due next week where I have to include images in JOptionPane, and while it works with local files I'm not sure if that'll show when I turn it in. Anyways, what I have is:
ImageIcon thing = new ImageIcon("http://i.imgur.com/OGxr68g.jpg");
String[] finalOutputChoices = {"Help", "Please"};
int finalOutput = JOptionPane.showOptionDialog(
null //
, "Message" //
, "Final Output" //
, JOptionPane.YES_NO_OPTION //
, JOptionPane.PLAIN_MESSAGE //
, thing //
, finalOutputChoices //
, "Awesome" //
);
If I replace the link with the path to an image on my desktop it works, but it doesn't with the link.
Any help would be appreciated :)
Works with a URL object.
ImageIcon thing = new ImageIcon(new URL("http://i.imgur.com/OGxr68g.jpg"));
PS: weird image ;-)