Patrik,
Looks to me like you have set up an infinite loop. The RubicCube3D
constructor calls a Select9CubesAndRotate constructor which calls a
RubicCube3D constructor which calls a Select9CubesAndRotate constructor
which calls a RubicCube3D constructor which calls a Select9CubesAndRotate
constructor which calls a RubicCube3D constructor ad infinitum. At some
point during construction one of the objects has to stop creating an
instance of the other object or you will have an infinitely long chain of
calls that will overflow any computer.
Raffi
-----Original Message-----
From: Patrik M�ller [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 16, 2001 1:15 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Stack Overflow
Hi all
I have a Stack overflow, but I don't now why!
Can somebody help me?
I think it has something to do with the mangenta line in the Code!
.java.lang.StackOverflowError
at java.lang.ref.Finalizer.<init>(Finalizer.java:70)
at java.lang.ref.Finalizer.register(Finalizer.java:75)
at rubiccube3d.RubicCube3D.<init>(RubicCube3D.java:64)
at rubiccube3d.Select9CubesAndRotate.<init>(Select9CubesAndRotate.java:22)
at rubiccube3d.RubicCube3D.<init>(RubicCube3D.java:64)
at rubiccube3d.Select9CubesAndRotate.<init>(Select9CubesAndRotate.java:22)
at rubiccube3d.RubicCube3D.<init>(RubicCube3D.java:64)
at rubiccube3d.Select9CubesAndRotate.<init>(Select9CubesAndRotate.java:22)
at rubiccube3d.RubicCube3D.<init>(RubicCube3D.java:64)
at rubiccube3d.Select9CubesAndRotate.<init>(Select9CubesAndRotate.java:22)
at rubiccube3d.RubicCube3D.<init>(RubicCube3D.java:64)
My Code:
public class RubicCube3D extends JFrame implements KeyListener {
// most high node of a Java3D scene
private static Locale locale;
private static TransformGroup mainTG = new TransformGroup();
private final static BoundingSphere boundingSphere = new
BoundingSphere(new Point3d(0.0,0.0,0.0),100.0);
// Array containing all 3*3*3 Cubes
public static CleverSubCube[][][] cleverSubCube = new
CleverSubCube[3][3][3];
Select9CubesAndRotate s = new Select9CubesAndRotate();
/**
* main function (called at start of this Java Application)
*/
public static void main(String[] args) {
RubicCube3D window = new RubicCube3D();
window.setTitle("Rubic's Cube 3D");
window.setIconImage(Toolkit.getDefaultToolkit().getImage(RubicCube3D.class.g
etResource(WINDOW_ICON)));
window.setSize(600, 500);
window.setLocation(200,100);
window.setVisible(true);
System.out.println("...OK");
} // end of main (method of RubicCube3D)
/**
* Constructor for the main class RubicCube3D
*/
public RubicCube3D() {
.....
} // end of RubicCube3D (constructor)
/**
* Create the whole Scene Graph
*/
public BranchGroup createSceneGraph(Canvas3D canvas3D) {
.....
} // end of CreateSceneGraph method of RubicCube3D
/**
* Create the whole View Graph
*/
public BranchGroup createViewGraph(Canvas3D canvas3D) {
...
} // end of CreateViewGraph method of RubicCube3D
private void jbInit() throws Exception {
.....
}
/**
* handles the events generated by pressing a key
*/
public void keyPressed(KeyEvent e){
System.out.println("keyPressed " + e);
}
/**
* handles the events generated by typing a key
*/
public void keyTyped(KeyEvent e) {
System.out.println("keyTyped " + e);
}
/**
* handles the events generated by releasing a key
*/
public void keyReleased(KeyEvent e){
System.out.println("keyReleased " + e);
}
} // end of class RubicCube3D
Patrik
E-mail mailto: [EMAIL PROTECTED]
==========================================================================To
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".