title: ImageObserver not working
body: <p>Can someone tell me what I need to do to get ImageObserver to work. I thought this would work. I'd like it to print a message when the image loads but it doesn't... What am I doing wrong? This can probably be answered easily.</p>
  
  <pre><code>import java.awt.Graphics;
  import java.awt.Image;
  import java.awt.image.BufferedImage;
  import java.awt.image.ImageObserver;
  import java.io.File;
  import java.io.IOException;
  
  import javax.imageio.ImageIO;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  
  
  public class ImageTest extends JPanel implements ImageObserver {
  
      @Override
      public boolean imageUpdate(Image img, int infoflags, int x, int y,
              int width, int height) {
          if((infoflags &amp; ALLBITS) == 0) {
              System.out.println("Processing still");
              return true;
          } else {
              System.out.println("Done processing");
              return false;
          }
      }
  
      public void paintComponent(Graphics g) {
          super.paintComponent(g);
          g.drawImage(img, 0, 0, this);
      }
  
      BufferedImage img;
  
      public ImageTest (){
          try {
              img = ImageIO.read(new File("res/soccer-ball.jpg"));
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  
      public static void main(String args[]) {
          JFrame f = new JFrame();
          f.setContentPane(new ImageTest());
          f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          f.setSize(1000, 1000);
          f.setVisible(true);
      }
  }
  </code></pre>