Mega Code Archive

 
Categories / Java by API / Org Eclipse Swt Widgets
 

MessageBox

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