MessageDialog.openWarning(Shell arg0, String title, String message)
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class MainClass extends ApplicationWindow {
public MainClass() {
super(null);
}
public void run() {
setBlockOnOpen(true);
open();
Display.getCurrent().dispose();
}
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText("Send Message");
shell.setSize(500, 400);
boolean b = MessageDialog.openConfirm(shell, "Confirm", "info");
System.out.println("Returned " + Boolean.toString(b));
MessageDialog.openError(shell, "Error", "info");
System.out.println("Returned void");
MessageDialog.openInformation(shell, "Information", "info");
System.out.println("Returned void");
b = MessageDialog.openQuestion(shell, "Question", "info");
System.out.println("Returned " + Boolean.toString(b));
MessageDialog.openWarning(shell, "Warning", "info");
System.out.println("Returned void");
}
public static void main(String[] args) {
new MainClass().run();
}
}
Related examples in the same category