"Puneet Wadhwa" <puneet_tech@yahoo.com> wrote:
>
>...Whereas in case of application we can't
>access methods such as getDocumentBase ...


If you add a canvas component where you want the image, you can paint the
image with the canvas' paint() method. To fetch the image, try something
like the following:

import java.awt.image.*;
import java.net.*;
import java.io.*;

class MyClass{
Image image = null;
...

public void fetchImage(String imageName){
//the parameter imageName might be something like
//"file:/C:\\myDir\\...\\myPicture.gif"
URL url = null;
try{
url = new URL(imageName);
}
catch(MalformedURLException murle){
System.out.println("Cannot find image " + imageName);
return;
}
try{
image = createImage((ImageProducer)url.getContent());
}
catch(IOException ioe){
System.out.println("Unable to fetch image " + url);
return;
}
}//fetchImage
...
}