new MessageBox(Shell parent, int style) : MessageBox « org.eclipse.swt.widgets « Java by API






new MessageBox(Shell parent, int style)


import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

public class MainClass {

  public static void main(String[] a) {
    Shell s = new Shell();
    MessageBox messageBox = new MessageBox(s, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
    messageBox.setMessage("Do you really want to exit?");
    messageBox.setText("Exiting Application");
    int response = messageBox.open();
    if (response == SWT.YES)
      System.out.println(SWT.YES);
    else if(response == SWT.NO)
      System.out.println(SWT.NO);

  }
}

           
       








Related examples in the same category

1.new MessageBox(shell, SWT.OK)
2.new MessageBox(shell, SWT.OK | SWT.CANCEL)
3.new MessageBox(shell, SWT.RETRY | SWT.CANCEL)
4.new MessageBox(shell, SWT.ABORT | SWT.RETRY | SWT.IGNORE)
5.new MessageBox(shell, SWT.YES | SWT.NO)
6.new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL)
7.new MessageBox(shell,SWT.ICON_ERROR)
8.new MessageBox(shell,SWT.ICON_QUESTION)
9.new MessageBox(shell,SWT.ICON_WARNING)
10.new MessageBox(shell,SWT.ICON_WORKING)
11.MessageBox: open()
12.MessageBox: setMessage(String mess)
13.MessageBox: setText(String text)