Hello all,
I am having a minor issue with displaying a "save confirmation" popup, when it is executed from the stop method of an
applet.
Here is the deal, I have an applet that draws a rectangular drawing based on user input (i.e. mouse clicks and arrow keystrokes). There is a save button that sends the data to a
servlet that updates a database, but some times the users forget to save and leave the applet's page, so their changes are not saved. There are instances where they may not want to save the changes so I can't automatically save the drawing.
Now here is my solution... I detect whether they have made any changes by setting a boolean value in certain event handlers. I then use a popup to display a JOptionPane.shoConfirmationDialog() when the applet's stop method is called (i.e. There are links to other areas of the application on the applets page which would call a different page).
My problem is that sometimes the popup is not getting focus and is not displayed "ON TOP" of the browser window. I am pretty sure that its because the applet is running in its own separate
thread than the browser window on the clients machine. Another issue, which is probably related to the above issue, is that even when the popup is displayed the browser still loads URL that was called before the user has clicked an option on the popup.
Now my gut is telling me there is only one thing I can do to rectify the situation... make all of the links on the page part of the applet itself. That way the call to a URL can be suspended while the popup is displayed. The only problem is that the application is running in a framed window and there are menu links that would be difficult to put on the applet.
Is this a valid approach or is there a better way?
Here is the stop() method’s code...
Thanks in advance.
Heath
[ August 05, 2002: Message edited by: Heath Lilley ]
[edited by Rob Ross to reduce width of post]
[ August 05, 2002: Message edited by: Rob Ross ]