Java Utililty Methods JOptionPane Error

List of utility methods to do JOptionPane Error

Description

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

Method

voidalertValidationError(final Component sourceComponent, final String message)
alert Validation Error
JOptionPane.showMessageDialog(sourceComponent,
        "Hold on.." + " Few values seems to be incorrect.!! Please correct them..\n" + message,
        "VALIDATION FAILED", JOptionPane.ERROR_MESSAGE);
intaskForAStringInArray(String question, String header, Object[] options, String errorMessage, String errorHeader)
Ask in a swing gui for something in array
int res = JOptionPane.CLOSED_OPTION;
while (res == JOptionPane.CLOSED_OPTION) {
    res = JOptionPane.showOptionDialog(null, question, header, JOptionPane.YES_NO_OPTION,
            JOptionPane.QUESTION_MESSAGE, null, 
            options, 
            options[0]); 
    if (res == JOptionPane.CLOSED_OPTION) {
        JOptionPane.showMessageDialog(null, errorMessage, errorHeader, JOptionPane.ERROR_MESSAGE);
...
TaskForAStringInArrayReturning(String question, String header, T[] options, String errorMessage, String errorHeader)
Ask in a swing gui for something in array
return options[askForAStringInArray(question, header, options, errorMessage, errorHeader)];
intcontChoose(final Component parent, final String title, final String message, final String noContMsg, boolean cont, boolean error)
cont Choose
final int optionType = (error) ? JOptionPane.ERROR_MESSAGE : JOptionPane.WARNING_MESSAGE;
if (cont) {
    return JOptionPane.showConfirmDialog(parent, message, title, JOptionPane.YES_NO_CANCEL_OPTION,
            optionType);
} else {
    JOptionPane.showMessageDialog(parent, noContMsg, title, optionType);
    return -1;
voidcreateAndShowErrorPanel(String title, Map messages)
create And Show Error Panel
JPanel jp = new JPanel(new BorderLayout(0, 0));
jp.setPreferredSize(new java.awt.Dimension(640, 480));
JTabbedPane tabs = null;
if (messages.size() > 1) {
    tabs = new JTabbedPane();
    jp.add(tabs);
for (String key : messages.keySet()) {
...
voiddisplayError(Component parent, String title, String message)
display Error
JOptionPane.showMessageDialog(parent, message, title, JOptionPane.ERROR_MESSAGE);
voiddisplayError(String message)
display Error
JOptionPane.showMessageDialog(null, message, "Error!", JOptionPane.ERROR_MESSAGE);
voiddisplayError(Throwable e)
display Error
displayMessageBox(e == null ? "Error performing operation." : e.getMessage(), JOptionPane.ERROR_MESSAGE,
        false);
voiddisplayErrorMessage(Component component, Throwable t)
display Error Message
Frame parent = null;
for (Component c = component; c != null && parent == null; c = c.getParent()) {
    if (c instanceof Frame) {
        parent = (Frame) c;
JDialog dialog = createExceptionDialog(parent, t.getClass().getName(), t);
dialog.setVisible(true);
...
voiddisplayErrorMessage(Component parent, String message)
Pops up error message dialog
JOptionPane.showMessageDialog(parent, message, "Error", JOptionPane.YES_NO_OPTION);