Computer
인터넷 이미지를 읽어온 뒤 화면에 출력
Theo Kim
2012. 6. 4. 22:58
import java.awt.Image; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class ReadImage { public static void main(String[] args) { Image image = null; try { URL url = new URL( "http://www.google.com/intl/en_ALL/images/srpr/logo1w.png"); image = ImageIO.read(url); } catch (IOException e) { e.printStackTrace(); } JFrame frame = new JFrame(); frame.setSize(300, 300); JLabel label = new JLabel(new ImageIcon(image)); frame.add(label); frame.setVisible(true); } }