How to Get Image from file
John C. Hayward
John.C.Hayward at wheaton.edu
Wed Jan 27 08:44:20 PST 1999
Thanks Alex for your suggestions!
On Tue, 26 Jan 1999, Alex Nicolaou wrote:
> > > In the applet class of java there is a getImage method for obtaining
> > > a Image from a URL. I would like to get an Image from a local file
> > > in a non applet application. What is the best way to do so?
> You can use Toolkit.getImage(String filename) to get the image in an
> application, but the API shows its age by not taking a File instance and
> is not portable to applets.
> The "officially sanctioned" way to do this is described in your API
> documentation or on the Java WWW site at
> (it's the second-last link on the JDK documentation page if you've
> downloaded the docs for 1.1.X). The basic jist of the method is "stick
> all your images in a JAR file and let Java find them for you". Amongst
> other advantages, bundling up the images cleans up the look of how your
> application installs, speeds your applet's download, and works for both
> applets and applications.
More information about the kaffe