A message box with the question icon, Yes/No button, and a simple question : MessageBox « SWT « Java Tutorial






A message box with the question icon, Yes/No button, and a simple question
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

public class MesssageBoxQuestionIconYESNOButton {
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    
    
    MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION |SWT.YES | SWT.NO);
    messageBox.setMessage("Is this question simple?");
    int rc = messageBox.open();
    
    System.out.println(rc == SWT.YES);
    System.out.println(rc == SWT.NO);
    
    display.dispose();    
  }
}








17.40.MessageBox
17.40.1.Displaying Messages
17.40.2.Displaying a Message Box
17.40.3.The Icon Styles for MessageBox
17.40.4.The Button Styles for MessageBox
17.40.5.A message box with the question icon, Yes/No button, and a simple questionA message box with the question icon, Yes/No button, and a simple question
17.40.6.MessageBox with Error IconMessageBox with Error Icon
17.40.7.MessageBox with Information Icon and OK Cancel ButtonMessageBox with Information Icon and OK Cancel Button
17.40.8.MessageBox with Information IconMessageBox with Information Icon
17.40.9.MessageBox with Question Icon and Yes No ButtonMessageBox with Question Icon and Yes No Button
17.40.10.MessageBox with Warning Icon and Yes No Cancel ButtonMessageBox with Warning Icon and Yes No Cancel Button
17.40.11.MessageBox with Working Icon and Abort Retry and Ignore ButtonMessageBox with Working Icon and Abort Retry and Ignore Button