JavaDocs から...
public static int showConfirmDialog(Component parentComponent,
Object message,
String title,
int optionType)
throws HeadlessException
Brings up a dialog where the number of choices is determined by the optionType parameter.
Parameters:
parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
message - the Object to display
title - the title string for the dialog
optionType - an int designating the options available on the dialog: YES_NO_OPTION, YES_NO_CANCEL_OPTION, or OK_CANCEL_OPTION
Returns:
an int indicating the option selected by the user
optionType
戻り値の型は、パラメーターに渡す値によって異なります
これは、次のようなことを行う必要があることを示唆しています...
int result = JOptionPane.showConfirmDialog(rootPane, "Are You Sure To Delete?", "Delete User", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION) {
// Do something here
}
詳細については、ダイアログの作成方法をご覧ください...