This applet demonstrates the use of Dialogs. It draws a string which is initially set to "Hello World!", but can be changed by clicking a "Change Text" button, which brings up a dialog, which is an instance of the TextEntryDialog class.

The source:
DialogExampleApplet.java
TextEntryDialog.java