Hi,

First of all you need to keep a handle on the controls object that you
create then you can simply query it when asked to perform the popup.
Provided your controls class has  java.awt.Component as an ancestor then
something like this should do it :

public class My3DApp
{
        private controls ctrl = null;

        ... All your other code

         public void controlsPopup()
        {
                if (ctrl == null) // Check if ctrl has been created yet, if
not then create a new instance
                {
                     controls ctrl = new controls();
                     this.toFront(); // keeps the focus with the main 3D app
                }

                else if (!ctrl.isShowing()) // If ctrl exists but is not
being displayed then show it on screen
                {
                    ctrl.setVisible(true);
                    this.toFront(); // keeps the focus with the main 3D app
                }

                // Only other case is that ctrl is already visible so do
nothing
         }
}



----- Original Message -----
From: "Grace S" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 30, 2002 1:20 PM
Subject: [JAVA3D] popup window


> Hi
>
> when I hit a key the a widow is opened from within the context of 3d
scene,
> but I was wondering how do I ensure that a window is only opened once i.e.
> if it already open then I do not want it to be opened again when the user
> presses the same key. Any suggestions would be appreciated.
>
> the follwing is the code used to open the window.
>
>         public void controlsPopup() {
>
>                 controls ctrl = new controls();
>                 this.toFront(); // keeps the focus with the main 3D app
>         }
>
> Thanks in advance
> Grace
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
===========================================================================
> 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