Images

by Michael Thomas

(Tutorial Home Page)

by Michael Thomas

(Tutorial Home Page)

Topic Notes
   
getImage
(Applet class)
Schedules the retrieval of an image file (.jpeg, .jpg & .gif).  Returns an Image or null if image not found.  A separate thread is created to load the image, therefore the image can load while the program continues.

getImage( [URL] );  //URL contains file name.
getImage( [URL], [filename] ); //URL contains directory only.

Examples:

  • getImage( getDocumentBase(), "MyImage.gif" );
  • getImage( getCodeBase(), "MyImage.gif" );
getDocumentBase()
(Applet class)
Returns the URL of the HTML document
getCodeBase()
(Applet class)
Returns the URL of the applet class file.
Image Formats
  • gif - Graphics Interchange Format
  • jpg or jpeg - Joint Photographic Experts Group
drawImage()
(Graphics class)