title: Buffered Image wouldn't load onto the JPanel object
body: <pre><code>public BufferedImage createImage(JPanel panel) {
  //Get top-left coordinate of drawPanel w.r.t screen
  Point p = new Point(0, 0);
  SwingUtilities.convertPointToScreen(p, panel);
  
  //Get the region with width and height of panel and 
  // starting coordinates of p.x and p.y
  Rectangle region = panel.getBounds();
  region.x = p.x;
  region.y = p.y;
  
  //Get screen capture over the area of region
  BufferedImage bi = null;
  try {
      bi = new Robot().createScreenCapture( region );
  } catch (AWTException ex) {
      Logger.getLogger(MyPaintBrush.class.getName()).log(Level.SEVERE, null, ex);
  }
  return bi; 
  }
  </code></pre>
  
  <p>Now, I want to be able to load the image back onto the JPanel <code>drawPanel</code>. The following is my attempt but it wouldn't work:</p>
  
  <pre><code>try {
      BufferedImage img = ImageIO.read(new File("D:\\Work Space\\Java\\Eclipse\\MyPaintBrush\\MyImage.png")); 
      JLabel picLabel = new JLabel(new ImageIcon(img));
      drawPanel.add(picLabel);
  } catch (IOException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>Please show me how it's done.</p>