title: displaying pictures from disk and URL side by side in java
body: <p>I would like to add picture from URL next to picture displaying from the disk but receving an error in line36 and have no clue how to sort it. Can you help me figured it out please ?</p>
  
  <p>It returning Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem: 
      Unhandled exception type IOException</p>
  
  <p>so should I catch MalformedURLException e + IOException e ? </p>
  
  <pre><code>import java.awt.*;
  import java.awt.image.BufferedImage;
  import java.io.File;
  import java.io.IOException;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.awt.Image;
  import javax.imageio.ImageIO;
  import javax.swing.ImageIcon;
  import javax.swing.JLabel;
  import javax.swing.JPanel;
  
  public class ObrazPanel extends JPanel {
  
      private BufferedImage image;
      private BufferedImage image2;
  
      public ObrazPanel()  {
          super();
  
      File imageFile = new File("C:\\Users\\KostrzewskiT\\eclipse-workspace\\zdjecie\\src\\zdjecie\\java.jpg");
      //File imageFile2 = new File("C:\\Users\\KostrzewskiT\\eclipse-workspace\\zdjecie\\src\\zdjecie\\java2.jpg");   
  
          try {
              image = ImageIO.read(imageFile);
          //  image2 = ImageIO.read(imageURL);
          } catch (IOException e) {
              System.err.println("Blad odczytu obrazka");
              e.printStackTrace();
          }
  
          try {
              URL imageURL = new URL ("http://beautyinspiration.pl/wp-content/uploads/2015/12/i-coach-otw.jpg");
              image2 = ImageIO.read(imageURL);
          } catch (MalformedURLException e) {
              System.err.println("Blad odczytu obrazka");
              e.printStackTrace();
          }
  
  //wymiar wyswietlanych obrazkow
          Dimension dimension = new Dimension(image.getWidth() + image2.getWidth(), image2.getHeight());
          setPreferredSize(dimension);
  
      }
  
  
      @Override
      public void paintComponent(Graphics g) {
          Graphics2D g2d = (Graphics2D) g;
          g2d.drawImage(image, 0, 0, this); //punkty w ktorych jest wyswietlane
          g2d.drawImage(image2, image.getWidth(), 0, this);
      }
  }
  </code></pre>