com.internationalnetwork.gui
Class JErrorMessage

Object
  extended by com.internationalnetwork.gui.JErrorMessage

public class JErrorMessage
extends Object

The JErrorMessage class provides a fancy, easy-to-use, blocking dialogue that displays an error message for the user, with a few simple choices that are defined by the developer.  There is also an option to send the error details to STDERR at the same time.

Future versions may include more advanced features such as copying the error text to the clipboard (but with additional information inserted to help the recipient; e.g., date and time, name of program, etc.) so they can easily send it in an eMail (an additional feature to link to the Operating System's standard eMail program, complete with a developer-specified eMail address and pre-filled message body containing the error text, is what we would like to do eventually).


Field Summary
static String VERSION
          Version number of this Package (read-only).
 
Constructor Summary
JErrorMessage()
           
 
Method Summary
static void main(String... args)
          This is used for demonstration purposes.
static int prompt(String title, String[] buttons, String... error)
          This is the same as prompt(title, buttons, exception, error...) except that it doesn't include a Throwable in the argument list.
static int prompt(String title, String[] buttons, Throwable exception, String... error)
          Presents the user with an error dialogue.  This method is designed with the intention of making it very easy to handle errors based on user interaction.
static int prompt(String title, Throwable exception, String... error)
          This is the same as prompt(title, buttons, exception, error...) except that it doesn't include any buttons in the argument list.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION
Version number of this Package (read-only).

See Also:
Constant Field Values
Constructor Detail

JErrorMessage

public JErrorMessage()
Method Detail

main

public static void main(String... args)
This is used for demonstration purposes.


prompt

public static int prompt(String title,
                         String[] buttons,
                         String... error)
This is the same as prompt(title, buttons, exception, error...) except that it doesn't include a Throwable in the argument list.

Please see the prompt(title, buttons, exception, error...) entry for full documentation.

Parameters:
title - Text to use in the frame's title (if NULL, default is "Error")
buttons - User options (if NULL or empty, the default of "Okay" {0} and "Exit" {-1} will be used instead)
error - Text that comprises the error information to be presented (use as many lines as you like)
Returns:
The value associated with the user's selection (if no choices were defined, then the default "Okay" button will be presented as the user's only choice, and it will yield a return code of 0)

prompt

public static int prompt(String title,
                         String[] buttons,
                         Throwable exception,
                         String... error)
Presents the user with an error dialogue.  This method is designed with the intention of making it very easy to handle errors based on user interaction.

Each button is defined as a String by a set of "key=value" pair parameters; the keys are (only "value" is required):

The value -1 will be returned by default when the user closes the Window or presses the Esc key (which is another way of closing it), so you might want to consider specifying -1 as the value of any "Exit" or "Cancel" button you create.

Parameters:
title - Text to use in the frame's title (if NULL, default is "Error")
buttons - User options (if NULL or empty, the default of "Okay" which will yield a retucn code of -1 will be used instead)
exception - The exception (may be NULL)
error - Text that comprises the error information to be presented (use as many lines as you like)
Returns:
The value associated with the user's selection (if no choices were defined, then the default "Okay" button will be presented as the user's only choice, and it will yield a return code of 0)

prompt

public static int prompt(String title,
                         Throwable exception,
                         String... error)
This is the same as prompt(title, buttons, exception, error...) except that it doesn't include any buttons in the argument list.

Please see the prompt(title, buttons, exception, error...) entry for full documentation.

Parameters:
title - Text to use in the frame's title (if NULL, default is "Error")
exception - The exception (may be NULL)
error - Text that comprises the error information to be presented (use as many lines as you like)
Returns:
The value associated with the user's selection (if no choices were defined, then the default "Okay" button will be presented as the user's only choice, and it will yield a return code of 0)