//The following program displays a simple non-modal dialog with an OK Button and no title-bar.
import java.applet.*;
import java.awt.*;
public class DialogTester extends Applet {
public void init( ) {
// This trick may not work in all browsers
// It works on Firefox on the Mac
Container container = this.getParent( );
while (! (container instanceof Frame)) {
container = container.getParent( );
}
Frame parent = (Frame) container;
Dialog myDialog = new Dialog(parent, false);
myDialog.setLocation(320, 240);
myDialog.add(new Label(“Hello “ + parent.getClass().getName()), BorderLayout.NORTH);
myDialog.add(new Button(“OK”), BorderLayout.SOUTH);
myDialog.pack( );
myDialog.show( );
}
}