Paul, Thanks for the response.
As a first shot, tried to create the Canvas3D in the processStimulus() method of a Behavior that does a postId() to itself. With that approach, I can continue to create as many Canvas3Ds as I want by pressing the JButton repeatedly, BUT the app. freezes after the creation of the very first one ! Now, this really is surprising since the Behavior approach, I'd have thought or have been made to believe so, should be able handle this more robustly. I'd like to be able to lazily create and add/remove Canvas3Ds from View. And I'm wondering what would be best practice for that ! Will try the SwingWorker approach too. --Vaidya >On Thu, 8 Jul 2004 09:20:10 -0700, Paul Byrne <[EMAIL PROTECTED]> wrote: >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". =========================================================================== 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".