Hello,

I tested the code you posted in the HelloUniverse and it never caused
deadlock. I also modified the code to create a new frame and show it with
the canvas. This also worked.

Linux/J2SDK 1.4.2_04/OGL/Java3D 1.3.2b4

There should not be a problem with swing deadlocking since the action
listener will be called from the swing thread.

-mike


-----Original Message-----
From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED]
On Behalf Of N. Vaidya
Sent: Thursday, July 08, 2004 8:48 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Issue with Runtime instantiation of Canvas3D

Hmm...This is really weird. All I'm trying to do is to instantiate a
Canvas3D in Swing's EDT - simply instantiate and not even add it to the
View - and I find that causes the app. to freeze.

The testcase is HelloWorld.java in the Java3D demo bundle with the
inclusion of the following code snippet in the init method (the snippet to
be included is the block between the BeginMods and EndMods comments; a few
lines below and after the block are duplicated to indicate where the
snippet should be pasted in the init() method).

Upon launching the app., you'll find a rotating cube and a JButton named
"Create Canvas3D". Upon pressing that button, which actually results in
the instantiation of a new Canvas3D, on my config. I find that the cube
stops rotating. Also try resizing the canvas to see what happens. Is there
anything odd with the GraphicsConfiguration returned by SimpleUniverse ?
I'm using Java3D 1.3.2-build3 and j2sdk1.4.2_03 on P4 WinXPs.

===========================================================

public void init() {
setLayout(new BorderLayout());
GraphicsConfiguration config =
   SimpleUniverse.getPreferredConfiguration();

Canvas3D c = new Canvas3D(config);
add("Center", c);

// BeginMods =======>
javax.swing.JButton canBtn = new javax.swing.JButton("Create Canvas3D");
canBtn.addActionListener( new ActionListener() {
    public void actionPerformed( ActionEvent e ) {
        Canvas3D newC =
              new Canvas3D(SimpleUniverse.getPreferredConfiguration());
    }
});
add("South", canBtn);
// EndMods ========>

// Create a simple scene and attach it to the virtual universe
BranchGroup scene = createSceneGraph();

=========================================================

TIA

--Vaidya

===========================================================================
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".

===========================================================================
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".

Reply via email to