Sunday, April 04, 2010

Input Dialog Box

An input dialog box asks a question and uses a text field to store the response.
The easiest way to create an input dialog in Java is to use showInputDialog(Component, Object, String, int) method of JOptionPane class.

The following example uses this method to create an input dialog box:

String response = JOptionPane.showInputDialog(null, "What is your name?", "Enter your name", JOptionPane.QUESTION_MESSAGE);

Source: java-tips.org

No comments:

Computers Add to Technorati Favorites Programming Blogs - BlogCatalog Blog Directory