MessageBox: setText(String text) : MessageBox « org.eclipse.swt.widgets « Java by API






MessageBox: setText(String text)


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 parent, int style)
2.new MessageBox(shell, SWT.OK)
3.new MessageBox(shell, SWT.OK | SWT.CANCEL)
4.new MessageBox(shell, SWT.RETRY | SWT.CANCEL)
5.new MessageBox(shell, SWT.ABORT | SWT.RETRY | SWT.IGNORE)
6.new MessageBox(shell, SWT.YES | SWT.NO)
7.new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL)
8.new MessageBox(shell,SWT.ICON_ERROR)
9.new MessageBox(shell,SWT.ICON_QUESTION)
10.new MessageBox(shell,SWT.ICON_WARNING)
11.new MessageBox(shell,SWT.ICON_WORKING)
12.MessageBox: open()
13.MessageBox: setMessage(String mess)