jbcl.control Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----java.awt.Window +----java.awt.Dialog +----javax.swing.JDialog +----com.borland.jbcl.control.ButtonDialog +----com.borland.jbcl.control.MessageDialog
Variables Constructors Properties Methods Event Listeners
Implements ActionListener, KeyListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants
MessageDialog
is a message box component that displays a text message of your choice and includes a set of buttons the user uses to respond to the message.
To set the message in the message box, set the message
property to the string you want to display. The title
property contains the text that appears on the title bar of the message box's frame.
The buttonSet
property determines which buttons appear in the dialog box. The following button sets are available:
OK | "OK" button. |
YES | "Yes" button. |
NO | "No" button |
CANCEL | "Cancel" button |
OK_CANCEL | "OK" and "Cancel" buttons |
YES_NO | "Yes" and "No" buttons |
YES_NO_CANCEL | "Yes", "No", and "Cancel" buttons |
When the user selects one of the buttons, its value is stored in the result
property. For example, if the user chooses OK, the value of result
property becomes OK.
If you prefer to have other labels on the buttons other than the standard OK, Yes, No, and Cancel strings, you can specify your own labels with the labels
property. The first string in the labels array becomes the label of the first button in the message box, the second string becomes the label of the second button, and so on.
To display the message box, call the show()
method.
Usually you should use Message
instead of MessageDialog
.
Message
calls the constructor of MessageDialog
,
but you can work with Message
within the UI Designer
and even display it at design time. You can set the properties of
MessageDialog
only at runtime.
protected String message
The text to display as the message in the message dialog.
protected Panel messagePanel
The panel to show in the message dialog.
public MessageDialog(Frame frame)Constructs a message box with the specified parent frame, no title-bar text, and no message string.
Parameters:
frame
public MessageDialog(Frame frame, String title)Constructs a message box with the specified parent frame and title-bar text, and no message string.
Parameters:
frame
title
public MessageDialog(Frame frame, String title, String msg)Constructs a message box.
Parameters:
frame
title
msg
public MessageDialog(Frame frame, String title, String msg, int buttonSet)Constructs a message box.
Parameters:
frame
title
msg
buttonSet
public void setFont(Font f)Determines the font of the text in the message dialog box.
public String getMessage() public void setMessage(String s)The message string to display in the message box.
public Dimension getPreferredSize()Returns the preferred size for the message dialog box.
public synchronized void addActionListener(ActionListener l) public synchronized void removeActionListener(ActionListener l)
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public synchronized void removeContainerListener(java.awt.event.ContainerListener )
public synchronized void addFocusListener(java.awt.event.FocusListener ) public synchronized void removeFocusListener(java.awt.event.FocusListener )
public synchronized void addInputMethodListener(java.awt.event.InputMethodListener ) public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )
public synchronized void addKeyListener(java.awt.event.KeyListener ) public synchronized void removeKeyListener(java.awt.event.KeyListener )
public synchronized void addMouseListener(java.awt.event.MouseListener ) public synchronized void removeMouseListener(java.awt.event.MouseListener )
public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener ) public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener ) public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )
public synchronized void addWindowListener(java.awt.event.WindowListener ) public synchronized void removeWindowListener(java.awt.event.WindowListener )