com.ibm.as400.ui.framework.java
Class MessageBoxDialog

java.lang.Object
  extended by com.ibm.as400.ui.framework.java.MessageBoxDialog

public class MessageBoxDialog
extends Object

A utility class used to display message boxes. MessageBoxDialog automatically splits long message strings into multiple lines so that the message box doesn't become too wide. You can display a simple message with an OK button, or a complex message box with multiple messages and push buttons.

Since:
v4r2m0
See Also:
JOptionPane

Field Summary
Modifier and Type Field and Description
static int ERROR
          Used to specify an error message.
static int INFORMATION
          Used to specify an informational message.
static int PLAIN
          Used to specify a plain message.
static int QUESTION
          Used to specify a question message.
static int WARNING
          Used to specify a warning message.
 
Method Summary
Modifier and Type Method and Description
static void dispose()
          Disposes the message dialog.
static void listAllWindows(String header)
           
static Object showMessageDialog(Component parent, Object[] message, String title, int type, boolean showIcon, Object[] options, Object initial)
          Displays a message dialog with user-defined options.
static Object showMessageDialog(Component parent, String msg, String title, int type)
          Displays a message dialog with an OK button.
static Object showMessageDialog(Component parent, String msg, String title, int type, boolean showIcon)
          Displays a message dialog with an OK button.
static Object showMessageDialog(Component parent, String msg, String title, int type, boolean showIcon, Object[] options, Object initial)
          Displays a message dialog with user-defined options.
static Object showMessageDialog(Component parent, String msg, String title, int type, Object[] options, Object initial)
          Displays a message dialog with user-defined options.
static Vector splitString(String str, int lineLength)
          Splits a string of text into a vector of strings.
static Vector splitString(String str, int lineLength, FontMetrics fm)
          Splits a string of text into a vector of strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR

public static final int ERROR
Used to specify an error message.

See Also:
Constant Field Values

INFORMATION

public static final int INFORMATION
Used to specify an informational message.

See Also:
Constant Field Values

WARNING

public static final int WARNING
Used to specify a warning message.

See Also:
Constant Field Values

QUESTION

public static final int QUESTION
Used to specify a question message.

See Also:
Constant Field Values

PLAIN

public static final int PLAIN
Used to specify a plain message.

See Also:
Constant Field Values
Method Detail

showMessageDialog

public static Object showMessageDialog(Component parent,
                                       String msg,
                                       String title,
                                       int type)
Displays a message dialog with an OK button.

Parameters:
parent - Determines the Frame in which the dialog is displayed. If null, or if the parent component has no Frame, a default Frame is used.
msg - Localized message to display.
title - Localized titlebar text.
type - the type of message that is to be displayed: MessageBoxDialog.ERROR, MessageBoxDialog.INFORMATION, MessageBoxDialog.WARNING, MessageBoxDialog.QUESTION, or MessageBoxDialog.PLAIN.
Returns:
the option selected or null if the dialog was closed
Since:
v4r5m0

showMessageDialog

public static Object showMessageDialog(Component parent,
                                       String msg,
                                       String title,
                                       int type,
                                       boolean showIcon)
Displays a message dialog with an OK button.

Parameters:
parent - Determines the Frame in which the dialog is displayed. If null, or if the parent component has no Frame, a default Frame is used.
msg - Localized message to display.
title - Localized titlebar text.
type - the type of message that is to be displayed: MessageBoxDialog.ERROR, MessageBoxDialog.INFORMATION, MessageBoxDialog.WARNING, MessageBoxDialog.QUESTION, or MessageBoxDialog.PLAIN.
showIcon - Determines whether the icon will be displayed on the dialog window
Returns:
the option selected or null if the dialog was closed
Since:
v4r5m0

showMessageDialog

public static Object showMessageDialog(Component parent,
                                       String msg,
                                       String title,
                                       int type,
                                       Object[] options,
                                       Object initial)
Displays a message dialog with user-defined options.

Parameters:
parent - Determines the Frame in which the dialog is displayed. If null, or if the parent component has no Frame, a default Frame is used.
msg - Localized message to display.
title - Localized titlebar text.
type - the type of message that is to be displayed: MessageBoxDialog.ERROR, MessageBoxDialog.INFORMATION, MessageBoxDialog.WARNING, MessageBoxDialog.QUESTION, or MessageBoxDialog.PLAIN.
options - An array of options. For example, {"Yes", "No", "Details"}.
initial - The initially selected option in the array supplied. Defaults to the first option.
Returns:
the option selected or null if the dialog was closed
Since:
v4r5m0

showMessageDialog

public static Object showMessageDialog(Component parent,
                                       String msg,
                                       String title,
                                       int type,
                                       boolean showIcon,
                                       Object[] options,
                                       Object initial)
Displays a message dialog with user-defined options.

Parameters:
parent - Determines the Frame in which the dialog is displayed. If null, or if the parent component has no Frame, a default Frame is used.
msg - Localized message to display.
title - Localized titlebar text.
type - the type of message that is to be displayed: MessageBoxDialog.ERROR, MessageBoxDialog.INFORMATION, MessageBoxDialog.WARNING, MessageBoxDialog.QUESTION, or MessageBoxDialog.PLAIN.
showIcon - Determines whether the icon will be displayed on the dialog window
options - An array of options. For example, {"Yes", "No", "Details"}.
initial - The initially selected option in the array supplied. Defaults to the first option.
Returns:
the option selected or null if the dialog was closed
Since:
v4r5m0

showMessageDialog

public static Object showMessageDialog(Component parent,
                                       Object[] message,
                                       String title,
                                       int type,
                                       boolean showIcon,
                                       Object[] options,
                                       Object initial)
Displays a message dialog with user-defined options.

Parameters:
parent - Determines the Frame in which the dialog is displayed. If null, or if the parent component has no Frame, a default Frame is used.
message - Localized message to display.
title - Localized titlebar text.
type - the type of message that is to be displayed: MessageBoxDialog.ERROR, MessageBoxDialog.INFORMATION, MessageBoxDialog.WARNING, MessageBoxDialog.QUESTION, or MessageBoxDialog.PLAIN.
showIcon - Determines whether the icon will be displayed on the dialog window
options - An array of options. For example, {"Yes", "No", "Details"}.
initial - The initially selected option in the array supplied. Defaults to the first option.
Returns:
the option selected or null if the dialog was closed
Since:
v4r5m0

dispose

public static void dispose()
Disposes the message dialog.

Since:
v4r5m0

splitString

public static Vector splitString(String str,
                                 int lineLength)
Splits a string of text into a vector of strings. Uses the UI's default font to calculate the splits.

Parameters:
str - the string to be split
lineLength - optimal number of characters on a line
Returns:
vector containing each line of the split string
Since:
v4r2m0

splitString

public static Vector splitString(String str,
                                 int lineLength,
                                 FontMetrics fm)
Splits a string of text into a vector of strings.

Parameters:
str - the string to be split
lineLength - optimal number of characters on a line
fm - font metrics of the font used to calculate the splits
Returns:
vector containing each line of the split string
Since:
v4r5m0

listAllWindows

public static void listAllWindows(String header)