public void paint(final Graphics g){
  g.drawImage(image,0,0,this);
synchronized (this) {
    if (!paintCalled) {
      paintCalled=true;
      notifyAll();
    }
  }
}

public void paint ( final Graphics g ) { g . drawImage ( image , 0 , 0 , this ) ; synchronized ( this ) { if ( ! paintCalled ) { paintCalled = true ; notifyAll ( ) ; } } }
paints the image on the window .
