Modal Window in Applet
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   harshat_Taide
Posted On:   Wednesday, June 5, 2002 08:39 AM

I have written an applet which calls a modal window (implemented using the Dialog(frame,true). This works fine when I run through the appletviewer but when I run through the browser, I can switch back and forth from my dialog box to browser and vice versa. But I do not want this to happen. I want that in my browser window too, the dialog box should be modal. I am using Internet Explorer ver 5.0. And if possible I would like to know that will the implementation be browser dependent, i.e if I use Netscape instead of IE do I need to write a different set of code.    More>>

I have written an applet which calls a modal window
(implemented using the Dialog(frame,true). This works fine

when I run through the appletviewer but when I run through

the browser, I can switch back and forth from my dialog box

to browser and vice versa. But I do not want this to

happen. I want that in my browser window too, the dialog

box should be modal. I am using Internet Explorer ver 5.0.

And if possible I would like to know that will the
implementation be browser dependent, i.e if I use
Netscape instead of IE do I need to write a different set

of code.

   <<Less

Re: Modal Window in Applet

Posted By:   Anonymous  
Posted On:   Wednesday, June 5, 2002 12:40 PM

As an applet is a subclass of component, you can call the

getParent()

method until you get a frame. Then call the dialog using the frame to display it modal.


I'm too lazy now to look up the code, but it should be similiar to this:


Object component = this.getParent();
while(component != null || !(component instanceof Frame))
{
component = component.getParent(),
}
if(component != null)
{
(new Dialog()).show(component, "it's modal babe", true);
}

hopefully, this works.


Bye, EyeDentity

About | Sitemap | Contact