Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How to find images from a java program?

I am using java.applet and java.awt to create graphics, and I am trying to have the program find an image in a folder called images using the following code:

getImage(getDocumentBase(), "images/c1.gif")

Where do I need to put the images folder in relation to the .java or .class files for this line of code to find the image, or is the code itself wrong?

1 Answer

Relevance
  • Chris
    Lv 7
    7 years ago

    The code looks ok, put the images folder in the folder where the .html file is (that's what getDocumentBase() will return).

Still have questions? Get your answers by asking now.