Basic HTML version of Foils prepared Sept 21 1998

Foil 19 Drawing Images to the applet window

From Java Tutorial 98- 3: Graphics and the Abstract Windowing Toolkit NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken


1 The Graphics class provides a method drawImage to actually display the image on the browser screen.
  • void paint ( )
    • { g.drawImage ( img, 10, 10, this) ; }
  • where the top left corner of the image will be drawn at (x,y) position (10,10)
  • use "this" as the ImageObserver argument, even if you don't use the ImageObserver to control downloading
2 You can also scale the image to a particular width and height.
  • void paint ( )
    • { g.drawImage ( img, 10, 10, w, h, this) ; }

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998