
Introduction to Swing • 751
Press ‘OK’ Press ‘Cancel’
Figure 23.13 Output screen of Program 23.14
Explanation: Due to 4th argument as 2, the method showMessageDialog displays an OK-Cancel
dialog box. Rest is simple to understand.
3. The showInputDialog method
The method has six forms:
static String showInputDialog(Object msg)
static String showInputDialog(Object msg, object ini_val)
static String showInputDialog(Component com, Object msg)
static String showInputDialog(Component com, Object msg, Object
ini_val)
static String showInputDialog(Component comp, Object msg, String
ini_val, int msgType)
static Object ...