|
-
October 13th, 2000, 05:55 PM
#1
Can a messagebox be popped up from an applet's stop() method?
Hi, everyone,
I want to show a messagebox before browser changed to other page. Is applet's stop() method a good place? Can I show messagebox in stop() method? I tried, in AppletViewer, it's OK, but not in IE and netscape. Can anyone do me a favor to give me some suggestions?
Thanks.
Sunny
Sunny Cheng
-
October 13th, 2000, 06:52 PM
#2
Re: Can a messagebox be popped up from an applet's stop() method?
Hi Sunny,
When user leaves current page, browser will destroy the Applet. Thus, even you pop up a message dialog in stop(), user may not see it because restroy() is called after stop(). Try to use JavaScript to display a message dialog instead of Java Applet.
HTH
Lynx
-
October 14th, 2000, 05:23 AM
#3
Re: Can a messagebox be popped up from an applet's stop() method?
I had tried to show dialog box in stop method, and it was working when I ran that applet in browser.
I used JRE1.2 that time. And dialog box was confirmation dialog in JOptionPane.
- UnicMan
http://members.tripod.com/unicman
-
October 14th, 2000, 05:25 AM
#4
Re: Can a messagebox be popped up from an applet's stop() method?
I had tried to show dialog box in stop method, and it was working when I ran that applet in browser.
I used JRE1.2 that time. And dialog box was confirmation dialog in JOptionPane.
You can try that if you haven't tried already.
btw I had observed that 'stop' method is called even if applet is minimized (i.e. browser window). I don't know if it happens for normal window... I used to open new window for applet in my software.
- UnicMan
http://members.tripod.com/unicman
-
October 14th, 2000, 08:40 PM
#5
Re: Can a messagebox be popped up from an applet's stop() method?
Yes, I'm using confirmation dialog of JOptionPane, jre1.2, IE and Netscape, neither could show it. Only AppletViewer could.
By the way, what is the first param for JOptionPane? null? this? this.parent()? or new Frame()? Only the last one I didn't try yet, all others weren't work.
Thanks.
Sunny.
Sunny Cheng
-
October 14th, 2000, 09:04 PM
#6
Re: Can a messagebox be popped up from an applet's stop() method?
Hi, Lynx,
I checked the jave doc, it said that before the stop() was called, the old page HAS BEEN destroied. But I wonder if the parent HAS BEEN destroied, could the children still exist? If it couldn't, stop() should be called BEFORE destroying the embeded page. And, the dialog is a modal frame in the same thread, system should wait for the user clicking then call destory(). So, I think that the dialog should be shown.
I don't want to use JavaScript, if I can find a way to do this. The applet is a information collector. I want to give users a chance to send their input to server before losing it.
Thanks
Sunny Cheng
-
October 17th, 2000, 09:14 AM
#7
Re: Can a messagebox be popped up from an applet's stop() method?
I tried with null as parent, its working in stop and destroy method.
- UnicMan
http://members.tripod.com/unicman
-
October 17th, 2000, 11:57 AM
#8
Re: Can a messagebox be popped up from an applet's stop() method?
Thank you.
I tried null, but It didn't work at my system. So,
I tried new JFrame(), new JWindow() as the parent.
the JWindow worked fine for me.
Thank you for your help.
Sunny Cheng
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|