ImageIO: read(URL input) : ImageIO « javax.imageio « Java by API






ImageIO: read(URL input)

  


import java.awt.BorderLayout;
import java.awt.Image;
import java.net.URL;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class Main {
  public static void main(String[] argv) throws Exception {
    // Read from a URL
    URL url = new URL("http://java.org/source.gif");
    Image image = ImageIO.read(url);

    JFrame frame = new JFrame();
    JLabel label = new JLabel(new ImageIcon(image));
    frame.getContentPane().add(label, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
  }
}

   
    
  








Related examples in the same category

1.ImageIO: createImageInputStream(Object input)
2.ImageIO: getImageReaders(Object input)
3.ImageIO: getImageReadersByFormatName(String formatName)
4.ImageIO: getImageReadersByMIMEType(String MIMEType)
5.ImageIO: getImageReadersBySuffix(String fileSuffix)
6.ImageIO: getImageWritersByFormatName(String formatName)
7.ImageIO: getImageWritersByMIMEType(String MIMEType)
8.ImageIO: getImageWritersBySuffix(String fileSuffix)
9.ImageIO: getReaderFormatNames()
10.ImageIO: getReaderMIMETypes()
11.ImageIO: getWriterFormatNames()
12.ImageIO: getWriterMIMETypes()
13.ImageIO: read(File input)
14.ImageIO: write(RenderedImage im, String formatName, File output)