MesssageBoxQuestionIconYESNOButton.java Source code

Java tutorial

Introduction

Here is the source code for MesssageBoxQuestionIconYESNOButton.java

Source

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();
    }
}