Hi Kovalan,

There are various ways to start your thread on the initial display of
the Canvas3D ... you can call isVisible() .. which will return true if
the jvm thinks the component has been rendered on the screen ... however
I find this isn't always reliable as there is some time lag between
calling setVisible(true) and the component actually being rendered ...
and so a check with getSize() can help .. if this returns (0,0) then the
component hasn't been rendered yet .. if you get the answer you were
looking for ( like the size you set it to be ) .. then it's been
displayed.

hope this helps

Andrew Fellows



Kovalan wrote :

Dear Reader,

I would like to start my animation thread just after the window shows
up.
How can I detect when this would happen. Currently, I have a lame way of

doing it:

    class AnimatorCanvas3D extends Canvas3D {
           :
        public void postSwap() {
            super.postSwap();
            if ( null == animator ) {
                setupInitialTransformation();

                animator = new Thread( parent );
                animator.start();
            }
        }
    }

Thanks,

Kovalan

Reply via email to