Theproblem comes from this piece of code in your class Texttest:
Polyhedron polyhedron[]=new Polyhedron[Vertices.length];
//Exception in thread "main" java.lang.NullPointerException
//ADD THE POLYHEDRON(s)
for(int i=0;i<Vertices.length;i++) {
group.addChild(polyhedron[i].getPolyedron(Vertices,Facets,VertexNo,VerticesNo[i],SumOfFacets[i],SumOfFacetsNo[i],i));
}
You create an array of Polyhedron object which are null. And then you parse
the array and call a method of each Polyhedron objects (which are null
hence the NullPointerException).
Set your getPolyedron() method as static.. it should work (don't forget to
move your shape and tg within the method).
or... why don't you call the creation code of your object (code within the
getPolyedron() method) in the constructor and have a getTransformGroup()
method?
So in your Textest class, you call:
Polyhedron polyhedron[]=new Polyhedron[Vertices.length];
//Exception in thread "main" java.lang.NullPointerException
//ADD THE POLYHEDRON(s)
Polyhedron tempPoly;
for(int i=0;i<Vertices.length;i++) {
tempPoly = new
Polyhedron(Vertices,Facets,VertexNo,VerticesNo[i],SumOfFacets[i],SumOfFacetsNo[i],i);
group.addChild(tempPoly.getTransformGroup());
/* If you want to fill in your array of created polyhedrons */
polyhedron[i] = tempPoly;
}
Jack
Γιάννης
<[EMAIL PROTECTED]> Pour : [EMAIL PROTECTED]
Envoyé par : cc :
Discussion list for Objet : [JAVA3D] Unfixed Error,
please your help [analysé par anti-virus CCAMA
Java 3D API : OK]
<[EMAIL PROTECTED]
VA.SUN.COM>
19/06/03 09:45
Veuillez répondre à
Discussion list for
Java 3D API
I cannot fix my error, my error is Exception in thread "main"
java.lang.NullPointerException
Could you test my Testtest class? And enlighten me.
The Testtest parses the solid4.txt which consists of 3 polyhedrons. The
parsing is correct but something goes wrong when i put the variables into
the costructor.
The polyhedron class generates a polyhedron shape(See attached file:
Texttest.java)(See attached file: solid4.txt)(See attached file:
Polyhedron.java)
Texttest.java
Description: Binary data
solid4.txt
Description: Binary data
Polyhedron.java
Description: Binary data
