wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes Modal dialog problem with JApplet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Modal dialog problem with JApplet" Watch "Modal dialog problem with JApplet" New topic
Author

Modal dialog problem with JApplet

tahelu kumar
Greenhorn

Joined: Nov 09, 2011
Posts: 16
Hi ,

When i make a JDialog modal, it only gets modal with respect to my JApplet only, but i want to make it modal with respect to browser.
like the usual modal dialogs which can be made using javascript.
Is there any way to make a JDialog modal with respect to browser.

Any hints or answer would help me a lot.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  19

I've checked a bit, and Internet Explorer 9 and Google Chrome only make dialogs modal for the current tab. Other tabs will not be blocked by a modal dialog. I think the reason is that, at least with Google Chrome, each tab has its own process. I think IE9 uses the same technique. You can't work around that. Firefox only has one process and therefore will have the dialog modal for the entire browser (tested with Firefox 8).

You will need to get a reference to the applet's parent window. Unlike with desktop applications, you don't create it. Instead, the browser or Java plugin creates one for you. You can get a reference to it like this:
All my tests have shown that this Window is always a Frame sub class, so you can use that too:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
tahelu kumar
Greenhorn

Joined: Nov 09, 2011
Posts: 16
Thanks for the reply Rob, but doing the things as you said did not work for me.
Here is my code:



and i am running the applet in browser by SampleApplet.html file, here is its code:




I place the html file and jar in same folder and run it.
What happening is even at the Firefox 8.0, the dialog is modal only with respect to my applet , not with respect to the tab and not also with browser.
tahelu kumar
Greenhorn

Joined: Nov 09, 2011
Posts: 16
i want to make this dialog modal for the current tab and for the whole browser(if possible).
tahelu kumar
Greenhorn

Joined: Nov 09, 2011
Posts: 16
Hi, can anyone help me here please?
tahelu kumar
Greenhorn

Joined: Nov 09, 2011
Posts: 16
Hi, can anyone help me here please?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you want to control how I use my browser?

that's an awful idea, and, by the lack of responses, I'd say I'm not alone in my opinion.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Modal dialog problem with JApplet