package pic

for some reason when i try to add a pic to an applet thats inside a package it cant find it . the pic is inside the images directory ,its a very wierd and suppose to be simple problem but i simply cant find the problem.
[240 byte] By [Ishaibina] at [2007-9-28 17:58:09]
# 1

When you say 'package', do you mean like the java.io package kind?

Since that would make absolutly no sense, I will assume that its a jar file.

Now I don't remember exactly how it's done in an applet, I recall getDocumentBase()/getCodeBase() being used somewhere, but in an application instead of this:

Toolkit tk = Toolkit.getDefaultToolkit();

Image image = tk.getImage("image.jpg");

It would be this:

Toolkit tk = Toolkit.getDefaultToolkit();

Image image = tk.getImage(this.getClass().getClassLoader().getResource("image.jpg"));

So I'm sure it's something simliar along those lines, only using the applets getImage method.

EvolvedAnta at 2007-7-12 15:40:48 > top of Java-index,Other Topics,Java Game Development...
# 2
you can create your own package ishaibin.comand im using awt commands and its not the problem , the problem is where do i put the pic , it cant find it anywhere i put it
Ishaibina at 2007-7-12 15:40:48 > top of Java-index,Other Topics,Java Game Development...