I have a JAVA applet that brings up an application modal dialog. The problem I am having is that the user can close the browser (or tab) and the dialog will remain up. If you click on the IE9 window area or menu bar the dialog appears modal, but when you click on the tabs or the window's "x" button IE9 is not modal to the dialog. I have tried various forms of modality and none seem to make the entire window and dialog modal. I tried using a window listener in the applet, but it doesn't seem to get the closing message. If you close the windows this way, the java process does not properly shut down and you have to kill it via the task manager. I don't remember this happening with IE8. Is there any way to make the entire IE9 window and my dialog modal?
Prior to raising the java modal, could you communicate back out to the page via liveconnect javascript call, setting a function to window.onclose that either sets focus back on the applet or prompts the user via browser confirm or alert?
Upon closing/dismissal of the applet dialog, you could clear the browser window.onclose function pointer.
Hope this helps,
-Scott H
Related
I have an applet in a webpage that accesses printers. Sometimes I get the warning dialog in the image below and before I can click anything, the dialog freezes and causes IE to become unresponsive. Any idea what could be causing this?
DIALOG
When I click on one button, it goes to another screen and one new popup window appeared. I don't know how to close. Can any one help me out this? Im using Eclipse for writing code.
If the child window is a HTML window then you can close the window by using driver.close() syntax. Here assume driver is instantiated properly.
If it is a Native or OS window then it is not possible to handle it through selenium.
I'm doing some bug fixing on an old applet, but I'm running into issues with applets destroy() being called while there is a confirm dialog open (JOptionPane.showConfirmDialog). Basically, If there is a dialog box open, and the browser window is closed, the dialog box stays open, and the applets keep running in the background (not in a browser window). Is there a way to close all the dialog boxes and ensure that all applets are destroyed when the browser window is closed?
EDIT: ok, to clarify, this confirm dialog is being opened in a thread that the applet starts. However, it has the instance of the applet that started it, and the confirm dialog is being started with JOptionPane.showConfirmDialog(applet_instance, ...) This should mean that the user is unable to access the browser while the dialog is up. However, I can still close the window behind the dialog, and this kills the applet, but not the thread that opened the dialog. How would I go about killing all the threads when the window is closed, or how do I actually stop the user from closing the window without acknowledging the dialog first?
EDIT 2: I just tried to make the dialog in the applet itself, at the end of the start() method. This results in a dialog right when the applet loads, but I can still close the browser window behind the dialog and the dialog remains...
I have a non-trivial Java applet. It has a menu, and via that menu applet shows a dialog that extends JDialog. Dialog is shown using setVisible(true). When user finishes working with that dialog, dialog is closed (after pressing "done" button) using this.dispose().
Now, there's a strange problem - applet works fine in Firefox, even in IE but in Chrome, when applet shows some other (dialog) window, that window is shown behind the applet. I have to click on the place where dialog should be in order to show it (bring it to front). If I click it again (while it's shown) it will disappear (go to background) again. Button clicks are working as usual, but whenever I click at popup window itself (even it's title-bar) it changes it's "visible" state.
Please, any idea what's wrong? How to resolve that bug?
// the applet will typically appear inside a Window, get a reference to it using:
Window parent = Window.getWindows()[0];
// use the window as the parent of a modal dialog.
JDialog dialog = new JDialog(parent);
dialog.setModal(true);
// ...
dialog.setVisible(true);
// won't be called until the applet is dismissed
someJComponent.requestFocusInWindow();
Applets embedded in web pages will always be subject to modality and focus problems. For a better user experience, launch the applet free-floating using Java Web Start, or even better still, launch a frame using JWS.
When a modal dialog is opened, is there any way to allow user close a JFrame by clicking Close on task-bar icon? I see that even if the dialog is orphan or a child of another frame, it still blocks the Close action.
It depends on the native OS you're running on, I don't know of any that do allow you to.
Here is a MSDN listing on it :
http://msdn.microsoft.com/en-us/library/aa969773.aspx
A modal dialog box is displayed by a function when the function needs
additional data from a user to continue. Because the function depends
on the modal dialog box to gather data, the modal dialog box also
prevents a user from activating other windows in the application while
it remains open.