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

java.lang.Object
  |
  +--com.ibm.as400.ui.framework.java.MessageBoxDialog

public class MessageBoxDialog
extends java.lang.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
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
static void dispose()
          Disposes the message dialog.
static java.lang.Object showMessageDialog(java.awt.Component parent, java.lang.Object[] message, java.lang.String title, int type, boolean showIcon, java.lang.Object[] options, java.lang.Object initial)
          Displays a message dialog with user-defined options.
static java.lang.Object showMessageDialog(java.awt.Component parent, java.lang.String msg, java.lang.String title, int type)
          Displays a message dialog with an OK button.
static java.lang.Object showMessageDialog(java.awt.Component parent, java.lang.String msg, java.lang.String title, int type, boolean showIcon)
          Displays a message dialog with an OK button.
static java.lang.Object showMessageDialog(java.awt.Component parent, java.lang.String msg, java.lang.String title, int type, boolean showIcon, java.lang.Object[] options, java.lang.Object initial)
          Displays a message dialog with user-defined options.
static java.lang.Object showMessageDialog(java.awt.Component parent, java.lang.String msg, java.lang.String title, int type, java.lang.Object[] options, java.lang.Object initial)
          Displays a message dialog with user-defined options.
static java.util.Vector splitString(java.lang.String str, int lineLength)
          Splits a string of text into a vector of strings.
static java.util.Vector splitString(java.lang.String str, int lineLength, java.awt.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.

INFORMATION

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

WARNING

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

QUESTION

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

PLAIN

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

showMessageDialog

public static java.lang.Object showMessageDialog(java.awt.Component parent,
                                                 java.lang.String msg,
                                                 java.lang.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 java.lang.Object showMessageDialog(java.awt.Component parent,
                                                 java.lang.String msg,
                                                 java.lang.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 java.lang.Object showMessageDialog(java.awt.Component parent,
                                                 java.lang.String msg,
                                                 java.lang.String title,
                                                 int type,
                                                 java.lang.Object[] options,
                                                 java.lang.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 java.lang.Object showMessageDialog(java.awt.Component parent,
                                                 java.lang.String msg,
                                                 java.lang.String title,
                                                 int type,
                                                 boolean showIcon,
                                                 java.lang.Object[] options,
                                                 java.lang.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 java.lang.Object showMessageDialog(java.awt.Component parent,
                                                 java.lang.Object[] message,
                                                 java.lang.String title,
                                                 int type,
                                                 boolean showIcon,
                                                 java.lang.Object[] options,
                                                 java.lang.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 java.util.Vector splitString(java.lang.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 java.util.Vector splitString(java.lang.String str,
                                           int lineLength,
                                           java.awt.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