I am trying to grab an image from online, and then use it to display on a Jframe form. The "Hello, World!" will display, but the image won't display. Any ideas guys? Cheers.
JFrame frame = new JFrame();
frame.setSize(400, 400);
JLabel label = new JLabel("Hello, World!");
String path = "http://chart.finance.yahoo.com/z?s=GOOG&t=6m&q=l";
try {
URL url = new URL(path);
ImageIcon image = new ImageIcon(url);
JLabel imageLabel = new JLabel(image);
label.setOpaque(true);
frame.add(imageLabel);
frame.add(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
} catch (MalformedURLException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}