I bet this is causing a deadlock in the swing code. Try using a Swing
WorkerThread so create the Canvas3D rather than doing it directly in the
swing event thread.

Rgds

Paul

N. Vaidya wrote:

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