moka.x
Class OptionPane

java.lang.Object
  |
  +--moka.lang.Object
        |
        +--moka.event.EventListener
              |
              +--moka.x.Component
                    |
                    +--moka.x.Container
                          |
                          +--moka.x.Frame
                                |
                                +--moka.x.OptionPane
All Implemented Interfaces:
Captioned

public class OptionPane
extends Frame

OptionPane makes it easy to pop up a standard dialog box that prompts users for a value or informs them of something.

Since:
MDK1.0a

Field Summary
static short CANCEL_OPTION
          Return value from class method if CANCEL is chosen.
static short DEFAULT_OPTION
          Default return value.
static short NO_OPTION
          Return value from class method if NO is chosen.
static short OK_CANCEL_OPTION
          Type used for showConfirmDialog.
static short OK_OPTION
          Return value form class method if OK is chosen.
static short YES_NO_CANCEL_OPTION
          Type used for showConfirmDialog.
static short YES_NO_OPTION
          Type used for showConfirmDialog.
static short YES_OPTION
          Return value from class method if YES is chosen.
 
Fields inherited from class moka.x.Frame
closeButtonVisible, defaultCloseOperation, DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE, minimizeButtonVisible, modal, movable
 
Fields inherited from class moka.x.Container
child, tail
 
Fields inherited from class moka.x.Component
enabled, height, listen, mnemonic, next, parent, prev, visible, width, x, y
 
Fields inherited from interface moka.x.Captioned
caption, font
 
Constructor Summary
OptionPane()
          Constructs a newly allocated OptionPane dialog.
 
Method Summary
static void cleanup()
          Called at the end of the program to free the ressources used by the static members of this class.
 void eventTriggered(java.lang.Object sender)
          Invoked when an event is triggered.
static short showConfirmDialog(moka.x.Container parent, java.lang.String title, java.lang.String message, short option)
          Brings up a dialog with the specified options (a combination of Yes, No and Cancel); with the specified title.
static short showConfirmDialog(java.lang.String message)
          Brings up a dialog with the options Yes, No and Cancel; with the title, Select an Option.
static java.lang.String showInputDialog(moka.x.Container parent, java.lang.String title, java.lang.String message)
          Shows a question-message dialog requesting input from the user.
static java.lang.String showInputDialog(java.lang.String message)
          Shows a question-message dialog requesting input from the user.
static void showMessageDialog(moka.x.Container parent, java.lang.String title, java.lang.String message)
          Brings up an information-message dialog.
static void showMessageDialog(java.lang.String message)
          Brings up an information-message dialog titled "Message".
 
Methods inherited from class moka.x.Frame
dispose, finalize, isCursorOver, isCursorOverCloseButton, isCursorOverMinimizeButton, isCursorOverTitleBar, onClose, onDrag, onMinimize, paint, paintForeground, setCloseButtonVisible, setMinimizeButtonVisible, setModal, setVisible, use
 
Methods inherited from class moka.x.Container
add, checkMnemonic, clean, empty, onPaint, onRefresh, paintChildren, remove, repaintChildren, toFront
 
Methods inherited from class moka.x.Component
bottom, center, left, move, right, setBounds, setEnabled, setHeight, setMnemonic, setWidth, setX, setY, top
 
Methods inherited from class moka.event.EventListener
eventTriggered
 
Methods inherited from class moka.lang.Object
equals, getClassName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface moka.x.Captioned
setCaption, setFont
 

Field Detail

YES_NO_OPTION

public static final short YES_NO_OPTION
Type used for showConfirmDialog.

See Also:
Constant Field Values

YES_NO_CANCEL_OPTION

public static final short YES_NO_CANCEL_OPTION
Type used for showConfirmDialog.

See Also:
Constant Field Values

OK_CANCEL_OPTION

public static final short OK_CANCEL_OPTION
Type used for showConfirmDialog.

See Also:
Constant Field Values

DEFAULT_OPTION

public static final short DEFAULT_OPTION
Default return value.

See Also:
Constant Field Values

YES_OPTION

public static final short YES_OPTION
Return value from class method if YES is chosen.

See Also:
Constant Field Values

NO_OPTION

public static final short NO_OPTION
Return value from class method if NO is chosen.

See Also:
Constant Field Values

CANCEL_OPTION

public static final short CANCEL_OPTION
Return value from class method if CANCEL is chosen.

See Also:
Constant Field Values

OK_OPTION

public static final short OK_OPTION
Return value form class method if OK is chosen.

See Also:
Constant Field Values
Constructor Detail

OptionPane

public OptionPane()
Constructs a newly allocated OptionPane dialog.

Method Detail

cleanup

public static void cleanup()
Called at the end of the program to free the ressources used by the static members of this class.


showMessageDialog

public static void showMessageDialog(java.lang.String message)
Brings up an information-message dialog titled "Message". The dialog will be centered on the screen.

Parameters:
message - The information-message to be displayed.

showMessageDialog

public static void showMessageDialog(moka.x.Container parent,
                                     java.lang.String title,
                                     java.lang.String message)
Brings up an information-message dialog. The dialog will be centered on its parent.

Parameters:
parent - The parent of the dialog.
title - The title of the dialog.
message - The information-message to be displayed.

showInputDialog

public static java.lang.String showInputDialog(java.lang.String message)
Shows a question-message dialog requesting input from the user. The dialog will be centered on the screen.

Parameters:
message - The question-message to be displayed.

showInputDialog

public static java.lang.String showInputDialog(moka.x.Container parent,
                                               java.lang.String title,
                                               java.lang.String message)
Shows a question-message dialog requesting input from the user. The dialog will be centered on its parent.

Parameters:
parent - The parent of the dialog.
title - The title of the dialog.
message - The question-message to be displayed.

showConfirmDialog

public static short showConfirmDialog(java.lang.String message)
Brings up a dialog with the options Yes, No and Cancel; with the title, Select an Option. The dialog will be centered on the screen.

Parameters:
message - The message to be displayed.

showConfirmDialog

public static short showConfirmDialog(moka.x.Container parent,
                                      java.lang.String title,
                                      java.lang.String message,
                                      short option)
Brings up a dialog with the specified options (a combination of Yes, No and Cancel); with the specified title. The dialog will be centered on its parent.

Parameters:
parent - The parent of the dialog.
title - The title of the dialog.
message - The message to be displayed.
option - The options to be displayed.

eventTriggered

public void eventTriggered(java.lang.Object sender)
Invoked when an event is triggered.

Overrides:
eventTriggered in class Component
Parameters:
sender - The object who triggered the event.