Java by API/org.eclipse.jface.dialogs/MessageDialog

Материал из Java эксперт
Версия от 14:32, 31 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

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





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





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





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





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