Mega Code Archive

 
Categories / Java Tutorial / SWT
 

A message box with the question icon, YesNo button, and a simple question

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