title: BufferedImage not displaying (all black) but Image can be displayed
body: <p>I'm new to Java graphics (computer graphics in general) and Stack Overflow, so please help me out and help me phrase my problem better.</p>
  
  <p>At the moment, I'm trying to display a BufferedImage alongside the original image in a Java GUI. This is my code:</p>
  
  <pre><code>Image oriImage = robot.getQwerkController().getVideoStreamService().getFrame(); //load the original image
  Graphics2D hi = bufferedImage.createGraphics();
  hi.drawImage(oriImage, 0,0, null); //draw the original image into the BufferedImage
  hi.dispose();
  images[0].put(oriImage, 1); //draws the original image in the first frame
  images[1].put(bufferedImage, 2); //draws the BufferedImage in the second frame
  </code></pre>
  
  <p>and the "put" function is as follows:</p>
  
  <pre><code>public synchronized void put(Image image, int frameNumber) {
      icon.setImage(image); //sets the image displayed by this icon
      display.paintImageIcon(icon, frameNumber); //paint the image onto the gui
      imageSet = true;
      notifyAll();
  }
  </code></pre>
  
  <p>However, the resulting GUI is as follows</p>
  
  <p><img src="https://i.stack.imgur.com/MNmLO.png" alt="enter image description here"></p>
  
  <p>So the Image works, but BufferedImage doesn't. I'd assume it works because BufferedImage is a subclass of Image...
  Any idea? Please let me know if additional code is needed~ Thanks in advance :)</p>
  
  <p>EDIT 1:</p>
  
  <p>I did some testing, and instead of using the original image, I created an whole new bufferedImage, and used Graphics2D to draw a line and then try and display it.
  here is the result:</p>
  
  <p><a href="https://i.imgur.com/rJAdp.jpg" rel="nofollow noreferrer">http://i.imgur.com/rJAdp.jpg</a></p>
  
  <p>So it works. Therefore there must be something wrong with the original image (or the conversion that happened)</p>
  
  <p>EDIT 2:
  I did a similar thing with bufferedImage and drew a line. The result are the same as EDIT 1, and therefore I think there's some problem with drawImage function.</p>
  
  <p>EDIT 3:
  I fixed the problem by putting a while loop around the drawImage to let it complete the image drawing (because it returns false if it hasn't finish drawing an image yet) and it worked! :D</p>
  
  <pre><code>boolean x = false;
  while (!x) {
      x = hi.drawImage(oriImage, 0,0, null); //draw the original image into the BufferedImage
  }
  </code></pre>