new MessageBox(shell, SWT.ABORT | SWT.RETRY | SWT.IGNORE)
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 MainClass { public static void main(String[] a) { Display display = new Display(); final Shell shell = new Shell(display); MessageBox mb = new MessageBox(shell, SWT.ABORT | SWT.RETRY | SWT.IGNORE); mb.setText("Message from SWT"); mb.setMessage("message body"); int val = mb.open(); String valString = ""; switch (val) { case SWT.OK: valString = "SWT.OK"; break; case SWT.CANCEL: valString = "SWT.CANCEL"; break; case SWT.YES: valString = "SWT.YES"; break; case SWT.NO: valString = "SWT.NO"; break; case SWT.RETRY: valString = "SWT.RETRY"; break; case SWT.ABORT: valString = "SWT.ABORT"; break; case SWT.IGNORE: valString = "SWT.IGNORE"; break; } System.out.println(valString); shell.close(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }