FileDocCategorySizeDatePackage
ShowImage2.javaAPI DocExample1462Mon Oct 16 19:44:02 BST 2000None

ShowImage2.java

// File: ShowImage2.java
// T Balls : Apr 1997
// Display a graphics image in an applet

import java.applet.*;
import java.awt.*;
import java.awt.image.*;

public class ShowImage2 extends Applet implements ImageObserver
{
	Image picture;
	public void init()
	{
		picture = getImage( getCodeBase(), "graphics/duke.gif" );
	}

	public void paint( Graphics g )
	{
		g.drawImage( picture, 25, 25, this );
	}

	public boolean imageUpdate( Image i, int flags, int x, int y, int w, int h )
	{
	   System.out.println( "Flags = " + flags );
	   if( (flags & ImageObserver.ABORT) != 0 )
	      System.out.print( "ABORT " );
	   if( (flags & ImageObserver.ALLBITS) != 0 )
	      System.out.print( "ALLBITS " );
	   if( (flags & ImageObserver.ERROR) != 0 )
	      System.out.print( "ERROR " );
	   if( (flags & ImageObserver.FRAMEBITS) != 0 )
	      System.out.print( "FRAMEBITS " );
	   if( (flags & ImageObserver.HEIGHT) != 0 )
	      System.out.print( "HEIGHT " );
	   if( (flags & ImageObserver.PROPERTIES) != 0 )
	      System.out.print( "PROPERTIES " );
	   if( (flags & ImageObserver.SOMEBITS) != 0 )
	      System.out.print( "SOMEBITS " );
	   if( (flags & ImageObserver.WIDTH) != 0 )
	      System.out.print( "WIDTH " );
	      
	   System.out.println( "x = " + x + " y = " + y + " w = " + w + " h = " + h );

	   if( (flags & ImageObserver.ALLBITS) != 0 )
	      return false;
      else
         return true;
	}
}