I used Symantec's Visual Cafe and I created a PasswordDialog (a Modal
Dialog with 2 textfields: login and password. Visual Cafe contains 2
classes, which it uses for creating PasswordDialogs: ModalDialog and
DialogBox. DialogBox contains the following:
-----------------------
import java.awt.Button;
import java.awt.Event;
import java.awt.Frame;
import java.awt.Dialog;
import java.awt.Rectangle;
public class DialogBox extends Dialog
{
public DialogBox(Frame f,String s,boolean modal)
{
super(f,s,modal);
setResizable(false);
}
public synchronized void show()
{
Rectangle bounds = getParent().bounds();
Rectangle abounds = bounds();
move(abounds.width,abounds.height);
super.show();
}
...
------------------------
and DialogBox, which is DialogBox's subclass, contains the following:
------------------------
import java.awt.Frame;
public class ModalDialog extends DialogBox
{
public ModalDialog(Frame f,String s)
{
super(f,s,true);
}
}
------------------------ That's all for ModalDialog.java
You can create any class "AnyDialog.java" which extends ModalDialog.java
and will be modal. Your applet should create an AnyDialog's instance.
Carlos Alberto Roman Zamitiz
Departamento de Ingenieria en Computacion, Facultad de Ingenieria UNAM
[EMAIL PROTECTED]
On Thu, 26 Nov 1998, Thor Erik Karlsen wrote:
> I have an applet that shows a dialog that is supposed to be modal. Since the only
>way i have found to display a dialog within an applet, is to create a parent frame
>for the dialog, the dialog wont be modal for the applet, only for the frame. Because
>of this the dialog isnt modal within the applet.
> Can anyone send me the code for creating modal dialogs for applets?
> Thanks!!
>
>
>