Dialog boxes are windows that are separated from the main application. It is usually placed in front of the user to catch his or her attention to an operation that needs to be performed. The dialog abstract class provides the basis for dialogs in SWT. It is possible to extend it in order to create a custom dialog or make use of the several templates already available, such as a confirmation message box or a file dialog.
The MessageBox
dialog is typically used to display information to the user, such as a possible error, or to obtain input from the user on an operation that needs to be performed. The dialog can be displayed with several buttons, such as yes or no. When the user makes a selection, the corresponding code branch is executed.
The trivial thing to do when using the MessageBox
dialog is to set its message through the setMessage
method. Nonetheless, there is a variety of icon styles along with several types of buttons that can be specified. We show the possible styles...