org.pzgui
Class DialogHelper

java.lang.Object
  extended by org.pzgui.DialogHelper

public abstract class DialogHelper
extends java.lang.Object

Provides some generic GUI helper functions for popping up Dialog boxes.

Author:
David Underhill

Constructor Summary
DialogHelper()
           
 
Method Summary
static int confirmDialog(java.lang.String title, java.lang.String msg, int type)
          Displays an confirm dialog box
static void displayError(java.lang.Exception e)
          Displays an error message from a thrown Excpetion
static void displayError(java.lang.String msg)
          Displays an error message
static void displayMessage(java.lang.String msg)
          Displays a message
static void displayMessage(java.lang.String title, java.lang.String msg)
          Displays a message
static java.lang.String getInput(java.lang.String msg)
          Displays an input dialog box with no default value set
static java.lang.String getInput(java.lang.String msg, java.lang.String defaultValue)
          Displays an input dialog box
static int getIntFromUser(java.lang.String msg, int min, int def, int max)
          Gets an integer from the user within the specified range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialogHelper

public DialogHelper()
Method Detail

displayError

public static void displayError(java.lang.Exception e)
Displays an error message from a thrown Excpetion

Parameters:
e - the exception whose message will be shown in a JOptionPane MessageDialog box

displayError

public static void displayError(java.lang.String msg)
Displays an error message

Parameters:
msg - the message which will be shown in a JOptionPane MessageDialog box

getInput

public static java.lang.String getInput(java.lang.String msg)
Displays an input dialog box with no default value set

Parameters:
msg - the message which will be shown in a JOptionPane InputDialog box
Returns:
value specified by the user

getInput

public static java.lang.String getInput(java.lang.String msg,
                                        java.lang.String defaultValue)
Displays an input dialog box

Parameters:
msg - the message which will be shown in a JOptionPane InputDialog box
defaultValue - the default value for the InputDialog box
Returns:
value specified by the user

confirmDialog

public static int confirmDialog(java.lang.String title,
                                java.lang.String msg,
                                int type)
Displays an confirm dialog box

Parameters:
title - the title of the message box
msg - the message which will be shown in a JOptionPane MessageDialog box
type - what kind of JOptionPane to use
Returns:
value chosen by the user

displayMessage

public static void displayMessage(java.lang.String msg)
Displays a message

Parameters:
msg - the message which will be shown in a JOptionPane MessageDialog box

displayMessage

public static void displayMessage(java.lang.String title,
                                  java.lang.String msg)
Displays a message

Parameters:
title - the title of the message box
msg - the message which will be shown in a JOptionPane MessageDialog box

getIntFromUser

public static int getIntFromUser(java.lang.String msg,
                                 int min,
                                 int def,
                                 int max)
Gets an integer from the user within the specified range.

Parameters:
msg - The prompt to show the user.
min - The minimum allowed value.
def - The default value/
max - The maximum allowed value.
Returns:
The user-specified value.