Basic HTML version of Foils prepared Sept 21 1998

Foil 18 Getting Images Downloaded

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


1 The Applet class provides a method getImage, which retrieves an image from a web server and creates an instance of the Image class.
2 Image img =
  • getImage(new URL("http://www.tc.com/image.gif"));
3 Another form of getImage retrieves the image file relative to the directory of the HTML or the directory of the java code.
  • Image img = getImage(getDocumentBase(), "images/image.gif");
  • Image img = getImage(getCodeBase(), "images/image.gif");

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