edu.northwestern.at.utils.swing
Class ConfirmYNC

java.lang.Object
  extended by edu.northwestern.at.utils.swing.ConfirmYNC

public class ConfirmYNC
extends java.lang.Object

A confirmation dialog with yes, no, cancel buttons, or just yes and no buttons.

Example:

// Check if we should save current file // before exiting program. switch ( ConfirmYNC.confirmYNC( "Do you want to save the file?" ) ) { // Cancel button pressed -- don't save, // don't exit. case ConfirmYNC.CANCEL: break; // Yes button pressed -- save then exit. case ConfirmYNC.YES: saveTheFile(); exit(); break; // No button pressed -- just exit. case ConfirmYNC.NO: exit(); break; };


Field Summary
static int CANCEL
          Button indices for checking return values.
static int NO
           
static int YES
           
 
Constructor Summary
ConfirmYNC()
           
 
Method Summary
static int confirmYN(java.lang.String msg)
          Constructs and displays a confirmation dialog with no parent window.
static int confirmYN(java.lang.String msg, java.awt.Window parent)
          Constructs and displays a confirmation alert.
static int confirmYN(StyledString msg)
          Constructs and displays a styled text confirmation dialog with no parent window.
static int confirmYN(StyledString msg, java.awt.Window parent)
          Constructs and displays a styled text confirmation alert.
static int confirmYNC(java.lang.String msg)
          Constructs and displays a confirmation dialog with no parent window.
static int confirmYNC(java.lang.String msg, java.awt.Window parent)
          Constructs and displays a confirmation alert.
static int confirmYNC(StyledString msg)
          Constructs and displays a styled text confirmation dialog with no parent window.
static int confirmYNC(StyledString msg, java.awt.Window parent)
          Constructs and displays a styled text confirmation alert.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANCEL

public static final int CANCEL
Button indices for checking return values.

See Also:
Constant Field Values

YES

public static final int YES
See Also:
Constant Field Values

NO

public static final int NO
See Also:
Constant Field Values
Constructor Detail

ConfirmYNC

public ConfirmYNC()
Method Detail

confirmYNC

public static int confirmYNC(java.lang.String msg,
                             java.awt.Window parent)
Constructs and displays a confirmation alert.

Parameters:
msg - The confirmation prompt.
parent - The parent window, or null if none. The dialog is positioned centered over its parent window horizontally and positioned with its top 25 pixels below the top of its parent.

confirmYNC

public static int confirmYNC(java.lang.String msg)
Constructs and displays a confirmation dialog with no parent window.

Parameters:
msg - The confirmation prompt.

confirmYN

public static int confirmYN(java.lang.String msg,
                            java.awt.Window parent)
Constructs and displays a confirmation alert.

Parameters:
msg - The confirmation prompt.
parent - The parent window, or null if none. The dialog is positioned centered over its parent window horizontally and positioned with its top 25 pixels below the top of its parent.

confirmYN

public static int confirmYN(java.lang.String msg)
Constructs and displays a confirmation dialog with no parent window.

Parameters:
msg - The confirmation prompt.

confirmYNC

public static int confirmYNC(StyledString msg,
                             java.awt.Window parent)
Constructs and displays a styled text confirmation alert.

Parameters:
msg - The confirmation prompt.
parent - The parent window, or null if none. The dialog is positioned centered over its parent window horizontally and positioned with its top 25 pixels below the top of its parent.

confirmYNC

public static int confirmYNC(StyledString msg)
Constructs and displays a styled text confirmation dialog with no parent window.

Parameters:
msg - The confirmation prompt.

confirmYN

public static int confirmYN(StyledString msg,
                            java.awt.Window parent)
Constructs and displays a styled text confirmation alert.

Parameters:
msg - The confirmation prompt.
parent - The parent window, or null if none. The dialog is positioned centered over its parent window horizontally and positioned with its top 25 pixels below the top of its parent.

confirmYN

public static int confirmYN(StyledString msg)
Constructs and displays a styled text confirmation dialog with no parent window.

Parameters:
msg - The confirmation prompt.