/home/wpollock1/public_html/Java/Greet3.java
/* A simple program to display a friendly greeting. This stand-alone
* Java program demonstrates keyboard input using a simple GUI method.
* The use of a GUI input method in an otherwise non-gui program is okay
* in the classroom but probably not otherwise.
* The dialogs of JOptionPane can be customized with special icons, titles,
* and different buttons. See the Java docs for details.
*
* Written by Wayne Pollock, Tampa, FL USA, 2002. Updated 2005 for Java5.
* Updated in 2010 to show message dialogs instead of console output.
*/
import javax.swing.JOptionPane;
class Greet3
{
public static void main ( String [] args )
{
String name = JOptionPane.showInputDialog( "Please enter your name: " );
// null is returned when the user clicks cancel:
if ( name != null )
JOptionPane.showMessageDialog( null, "Hello " + name + "!" );
// Here's an example that changes the title and the type too:
JOptionPane.showMessageDialog( null, "End of Program",
"Greet3 Dialog", JOptionPane.PLAIN_MESSAGE );
} // End of main
} // End of class Greet3