[2027] in java-interest
Re: Displaying a Gif...
daemon@ATHENA.MIT.EDU (Jim Graham)
Fri Sep 22 03:46:25 1995
Date: Thu, 21 Sep 1995 17:08:51 -0700
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM, karl@one.net
> Would anyone care to show some sample code to simply display a gif
> in a -standalone- java program. Not an applet.
Unfortunately the standard Java packages do not contain the helper classes
that you need to do this, nor do they contain factory-style APIs to
instantiate the sun-specific classes you need. Only the Applet class
with its AppletContext and AppletStub contain the necessary environment
to get these classes instantiated for you in a portable way.
This is an oversight...
For now, you will have to instantiate one of:
new sun.awt.image.FileImageSource(String filename);
new sun.awt.image.URLImageSource(String href);
new sun.awt.image.URLImageSource(URL u);
which will give you an object that implements "ImageProducer". From that
you can use:
Toolkit.getDefaultToolkit().createImage(ImageProducer ip);
Since this requires you to refer to a class in a sun-specific package
directly, this won't be portable.
...jim
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com