Java Utililty Methods JOptionPane Confirmation

List of utility methods to do JOptionPane Confirmation

Description

The list of methods to do JOptionPane Confirmation are organized into topic(s).

Method

intshowConfirmDialog(String message)
Shows a confirm dialog with "Yes", "No", and "Cancel" buttons.
return JOptionPane.showConfirmDialog(frame, message);
booleanshowConfirmDialog(String title, String message)
Convenience method to show a confirmation dialog.
int n = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_CANCEL_OPTION,
        JOptionPane.WARNING_MESSAGE);
return (n == JOptionPane.OK_OPTION);
intshowConfirmMessage(String message, Component component)
show Confirm Message
int confirm = JOptionPane.showConfirmDialog(component, message, "Konfirmasi", JOptionPane.YES_NO_OPTION);
return confirm;
intshowQuestionConfirmBox(Component pParent, String pMessage, String pTitle, String pLeftOption, String pRightOption)
show Question Confirm Box
UIManager.put("OptionPane.noButtonText", pLeftOption);
UIManager.put("OptionPane.yesButtonText", pRightOption);
int result = JOptionPane.showConfirmDialog(pParent, pMessage, pTitle, JOptionPane.YES_NO_OPTION,
        JOptionPane.QUESTION_MESSAGE);
UIManager.put("OptionPane.noButtonText", "No");
UIManager.put("OptionPane.yesButtonText", "Yes");
return result;
intshowReplaceExistingFileConfirmDialog(Component parentComponent, File file)
show Replace Existing File Confirm Dialog
return JOptionPane.showConfirmDialog(parentComponent,
        "Do you want to replace the existing file " + file + " ?", "Warning",
        JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);