Hello,
I've tried for a few hours to load a picture from the Internet but I can't get it work!
Local images are shown without any problems. The access to the Internet works also,
I can read a RSS feed for example.
Here is my code sample:
import java.awt.MediaTracker;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class DataModelTest
{
public static void main(String[] args)
{
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
frame.setContentPane(panel);
ImageIcon i = null;
i = new ImageIcon("http://img.stern.de/_content/58/10/581065/hai_500.jpg");
while ( i.getImageLoadStatus() == MediaTracker.LOADING );
JLabel label = new JLabel(i);
i.setImageObserver(label);
System.out.println("Adding Image Label");
panel.add( label );
frame.setSize(950, 650);
frame.setVisible(true);
}
}
I'm thankfull for any help!!
Greets,
cyb