import javax.swing.*; import java.awt.BorderLayout; import java.net.URL; import java.net.MalformedURLException; public class JUrlTest1 extends JFrame{ public static void main(String[] args){ JUrlTest1 frame = new JUrlTest1(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(10, 10, 150, 150); frame.setTitle("ƒ^ƒCƒgƒ‹"); frame.setVisible(true); } JUrlTest1(){ URL url = null; try{ url = new URL("http://www.javadrive.jp/tutorial/imageicon/hasami.png"); }catch(MalformedURLException e){ e.printStackTrace(); } JLabel label = null; if (url != null){ ImageIcon icon = new ImageIcon(url); label = new JLabel(icon); }else{ label = new JLabel("Not image"); } JPanel p = new JPanel(); p.add(label); getContentPane().add(p, BorderLayout.CENTER); }