borland Packages  Class Hierarchy  jbcl.control Package  Index 

Message component

java.lang.Object
   +----borland.jbcl.control.Message

About the Message component

Variables  Constructors  Properties  Methods  Event Listeners

Implements WindowListener, Serializable, EventListener

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.

You can make the Message component appear at design time:

  1. Drop the Message component on the UI Designer or on the Component Tree.
  2. Set whatever properties you want in the Component Inspector.
  3. Set the frame property to this in the Component Inspector.
  4. Set the visible property to true.

To make the message box appear at runtime, call the show() method or set the visible property to true.


Message variables

Variables implemented in this class

Message constructors

Message properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

Message methods

Methods implemented in this class

Methods implemented in java.lang.Object

Message event listeners


Message variables

actionMulticaster

  protected transient ActionMulticaster actionMulticaster

buttonSet

  protected int buttonSet
Represents which button set to show. The int constants are listed in the table above.

CANCEL

  public static final int CANCEL = ButtonDialog.CANCEL
A constant to represent the button set consisting of the "Cancel" button.

dialog

  protected MessageDialog dialog
The MessageDialog object used for the message box.

frame

  protected Frame frame
The parent frame for the message box.

labels

  protected String[] labels
The text to show on the buttons. The underlying buttons are still the standard buttons, functionally, such as "Yes", "No", and "Cancel", but the visible text can be changed, such as to another spoken language.

message

  protected String message
The message to show in the message box.

NO

  public static final int NO = ButtonDialog.NO
A constant to represent the button set consisting of the "No" button.

OK

  public static final int OK = ButtonDialog.OK
A constant to represent the button set consisting of the "OK" button.

OK_CANCEL

  public static final int OK_CANCEL = ButtonDialog.OK_CANCEL
A constant to represent the button set consisting of the "OK" and "Cancel" buttons.

result

  protected int result
Which button was clicked.

title

  protected String title
The title-bar text of the message box.

YES

  public static final int YES = ButtonDialog.YES
A constant to represent the button set consisting of the "Yes" button.

YES_NO

  public static final int YES_NO = ButtonDialog.YES_NO
A constant to represent the button set consisting of the "Yes" and "No" buttons.

YES_NO_CANCEL

  public static final int YES_NO_CANCEL = ButtonDialog.YES_NO_CANCEL
A constant to represent the button set consisting of the "Yes", "No", and "Cancel" buttons.


Message constructors

Message()

  public Message()
Constructs a message box with no parent frame, title-bar text, or message string.

Message(java.awt.Frame)

  public Message(java.awt.Frame frame)
Constructs a message box with the specified parent frame, no title-bar text, and no message string.

Parameters:

frame
The parent frame for the message box.

Message(java.awt.Frame, java.lang.String)

  public Message(java.awt.Frame frame, java.lang.String title)
Constructs a message box with the specified parent frame and title-bar text, and no message string.

Parameters:

frame
The parent frame for the message box.
title
The title-bar text for the message box.

Message(java.awt.Frame, java.lang.String, java.lang.String)

  public Message(java.awt.Frame frame, java.lang.String title, java.lang.String msg)
Constructs a message box.

Parameters:

frame
The parent frame for the message box.
title
The title-bar text for the message box.
msg
The message string to display in the message box.

Message properties

buttonSet

 public int getButtonSet()
 public void setButtonSet(int bs)
Determines which buttons appear in the message box. These are the possible button sets:

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

frame

 public Frame getFrame()
 public void setFrame(java.awt.Frame frame)
Determines the parent frame for the message box.

labels

 public String[] getLabels()
 public void setLabels(java.lang.String[] l)
Determines the text that appears on the buttons. If no value is assigned, the standard OK, Cancel, Yes, or No strings appear. The first string in the array of Strings becomes the label on the first button in the message box. The second string becomes the label on the second button, and so on.

message

 public String getMessage()
 public void setMessage(java.lang.String message)
The message string to display in the message box.

result

 public int getResult()
 public void setResult(int i)
Stores the user's choice of buttons to respond to the message box. For example, if the user chooses the OK button, the value of result becomes OK. The value must be one of the Message variables.

title

 public String getTitle()
 public void setTitle(java.lang.String title)
Determines the text that appears on the title bar, if any.

visible

 public boolean isVisible()
 public void setVisible(boolean visible)
Determines whether the message box is visible. If true, the message box is visible onscreen; if false, it isn't visible. The show() method sets the visible property to true.

Message methods

show()

  public void show()
Displays the message box by setting the visible property to true.


Message event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events.

action

 public void addActionListener(java.awt.event.ActionListener l)
 public void removeActionListener(java.awt.event.ActionListener l)