com.evanmclean.evlib.swing
Class SafeOptionPane

java.lang.Object
  extended by com.evanmclean.evlib.swing.SafeOptionPane

public final class SafeOptionPane
extends Object

Thread safe JOptionPane calls.

Author:
Evan McLean McLean Computer Services (see the overview for copyright and licensing.)

Method Summary
static int showConfirmDialog(Component parent, Object msg, String title, int option_type)
          Calls JOptionPane.showConfirmDialog in a thread-safe manner.
static String showInputDialog(Component parent, Object msg, String initial_value)
          Calls JOptionPane.showInputDialog in a thread-safe manner.
static void showMessageDialog(Component parent, Object msg, String title, int message_type)
          Calls JOptionPane.showMessageDialog in a thread-safe manner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

showConfirmDialog

public static int showConfirmDialog(Component parent,
                                    Object msg,
                                    String title,
                                    int option_type)
                             throws InterruptedException,
                                    InvocationTargetException
Calls JOptionPane.showConfirmDialog in a thread-safe manner. If it is in the event dispatch thread then it calls directly, otherwise it uses SwingUtilities.invokeAndWait.

Parameters:
parent -
msg -
title -
option_type -
Returns:
Same value os JoptoinPane.showConfirmDialog.
Throws:
InterruptedException
InvocationTargetException

showInputDialog

public static String showInputDialog(Component parent,
                                     Object msg,
                                     String initial_value)
                              throws InterruptedException,
                                     InvocationTargetException
Calls JOptionPane.showInputDialog in a thread-safe manner. If it is in the event dispatch thread then it calls directly, otherwise it uses SwingUtilities.invokeAndWait.

Parameters:
parent -
msg -
initial_value -
Returns:
Same value as JOptonPane.showInputDialog.
Throws:
InterruptedException
InvocationTargetException

showMessageDialog

public static void showMessageDialog(Component parent,
                                     Object msg,
                                     String title,
                                     int message_type)
                              throws InterruptedException,
                                     InvocationTargetException
Calls JOptionPane.showMessageDialog in a thread-safe manner. If it is in the event dispatch thread then it calls directly, otherwise it uses SwingUtilities.invokeAndWait.

Parameters:
parent -
msg -
title -
message_type -
Throws:
InterruptedException
InvocationTargetException