On Tuesday 12 November 2002 12:51 pm, Lan Wu-Cavener wrote: > 1. Does anyone has this type of sample code? I have not much experience > writing another thread. How to assign the priority to a thread?
Another thread is simple in Java. Just create a class that extends Thread and implement the run method. When your application creates an object of this class, it should call myThread.start(). This will call the run method of the Thread object (which you overloaded) and then return (with the run method running in a different thread). To change the priority of a thread, just call Thread.setPriority(int). The trick to threading is synchronization between threads. You cannot share data between the threads unless you ensure that only one thread is working on the data at the same time. The Java3D scenegraph is thread safe, so you can work with it in each thread, but other things, like lists, are not thread safe. Threading can get very complex. You can find many, many books on the topic at your local online book store. > > I got the error that only BranchGroup can be removed. this means that the > branchGroup has not been fully detached (still alive). Otherwise, > removing children from a non-alive BranchGroup should be fine. Are you sure it is still live and not just compiled? Check the isLive() method on the branchgroup. -mike -- Mike Pilone <[EMAIL PROTECTED]> http://www.slac.com/mpilone/personal/ GPG Fingerprint = 856C 8B36 ECF7 9156 4611 7C6B C265 05C4 162F C3B5 See http://www.slac.com/mpilone/personal/mpilone_pub_key.gpg for full key. See http://www.gnupg.org for GPG information. =========================================================================== 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".
