Hi Egon,
as you know I'm loading texture in this way:
texMan.addTexture("car1.jpg",new Texture(getDocumentBase(),"textures/car1.jpg"));
in my applet context. Considering that I'm using now a certificate, so I can access to the local filesystem, I'd like to load texture in a generic way using a for cycle (as you do in fps) :
File dir=new File("textures");
String[] files=dir.list();
for (int i=0; i<files.length; i++) {
String name=files[i];
if (name.endsWith(".jpg")) {
texMan.addTexture(name, new Texture("textures"+File.separator+name));
}
}
but, when I run the applet the Java console says:
java.lang.NullPointerException
at ThreeDSimApplet.init(ThreeDSimApplet.java:238)
at sun.applet.AppletPanel.run(AppletPanel.java:348)
at java.lang.Thread.run(Thread.java:536)
there's another way to load texture in a generic way in my context? Bye and thanks
The exception happens somewhere in your code. What exactly is in line 238?
Line 238 is:
for (int i=0; i<files.length; i++) {
That means that files is null, which means that dir.list() returns null, which means that your "textures"-directory doesn't exist. At least not there where you expect it to be. Try the complete path (i.e. "c:\blah\blubb\...\textures" or similar) and see if that works.
Ok, it works using slash. Bye and thanks :D