Messages of subject
Loading images from .gif files |
Alessandro
Location : Florianópolis/Brazil
Member since : May 9, 2003
Messages : 1
|
May 14, 2003 at 7:09 PM
I've been using PJA library on UNIX platform
where no Display is available. So I want to load an image from a .gif file. I
try to do that using
PJAImage loadImage =
(PJAImage)PJAToolkit.getDefaultToolkit().getImage("D:\\grafo.gif");
but it doesn't work. What should I do?
Alessandro B. Bovo
Brazil
|
Manu
Location : Paris / France
Member since : Apr 29, 2003
Messages : 394
|
May 14, 2003 at 10:55 PM
What do you want to do with that image ?
You've got two solutions to load the image itself :
+ Either you use a Java standard solution like :
Image loadImage = Toolkit.getDefaultToolkit().getImage("D:\\grafo.gif");
and you run your program with the java options suggested in the PJA FAQ "What options do I have to add to java command line to use PJA with my servlet server on UNIX platform ?"
java -Xbootclasspath/a:pja.jar
-Dawt.toolkit=com.eteks.awt.PJAToolkit
-Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment yourClass
+ Or you use directly PJA classes :
PJAImage loadImage = new PJAImage (new com.eteks.awt.image.GIFDecoder (new FileInputStream ("D:\\grafo.gif"), true));
This second solution doesn't require pja.jar to be in bootclasspath. --- Manu (moderator/modérateur)
|