Dialog boxes are used for transient data
-
Issue warning to user or require (third argument true) user to verify some action etc. - e.g. this dialog box has warning text and an ok button:
-
class WarningDialog extends Dialog
-
{ public WarningDialog(Frame parent)
-
{super(parent, "Dialog Box Label", true); //modal requires immediate
-
add(new Label("Read this stern Warning!"));
-
Button b = new Button("OK"));
-
b.addActionListener(this); add(b);
-
setSize(200,100); }
-
public void actionPerformed(ActionEvent e)
-
{if (e.getActionCommand().equals("OK")) dispose();
-
}
-
}
|