The information in this article applies to:
SUMMARYThis article describes how to create a modal dialog box with respect to the Internet Explorer browser in Java. The class java.awt.Dialog allows you to create a modal dialog box, but this dialog box is not modal with respect to the browser. To create a modal dialog box with respect to the browser, you can use Internet Explorer 4.0's showModalDialog method (part of the Window object). Due to a limitation in calling showModalDialog directly from Java, a technique is used to call the showModalDialog method on behalf of the Virtual Machine for Java. MORE INFORMATION
The following HTML and Java applet demonstrates how to create a modal
dialog box from Java under Internet Explorer 4.0. This sample demonstrates
invoking the showModalDialog method from Java using the setTimeout method
and interaction between Java and Internet Explorer 4.0 using AutoIDispatch.
The following HTML creates a Java applet called DialogTest and, upon
initialization, passes in a reference to "this" via the setMyObject()
method in the applet. The applet stores a reference to this object in order
to call the method doModal, which in turn sets a timeout that is a
workaround for calling showModalDialog directly. The argument passed into
doModal() is passed down to showModalDialog as the dialog argument into the
modal dialog box.
The following HTML is the DialogTestDialog.html referenced in the HTML
above. This HTML effectively becomes the modal dialog box. It takes the
window.dialogArguments variable (which originated from the Java applet) and
puts this string into a text field. When the user clicks the "click me"
button on this page, the window.returnValue is set to the value of this
text field. The above HTML then displays the return value using the
JavaScript alert() method.
REFERENCES
See the Internet Client SDK documentation for more information on the
showModalDialog method in Internet Explorer 4.0.
Q172202 INFO: Implementing Java Automation Objects using AutoIDispatch For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, please see the following pages on the Microsoft Technical Support site: http://support.microsoft.com/support/visualj/ Additional query words: modal dialog internet explorer
Keywords : kbcode kbSDKJava300 kbSDKJava310 JCOM JVM kbSDKJava320 |
Last Reviewed: November 16, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |