Java by API/org.eclipse.swt.widgets/MessageBox
Содержание
- 1 MessageBox: open()
- 2 MessageBox: setMessage(String mess)
- 3 MessageBox: setText(String text)
- 4 new MessageBox(Shell parent, int style)
- 5 new MessageBox(shell, SWT.ABORT | SWT.RETRY | SWT.IGNORE)
- 6 new MessageBox(shell,SWT.ICON_ERROR)
- 7 new MessageBox(shell,SWT.ICON_QUESTION)
- 8 new MessageBox(shell,SWT.ICON_WARNING)
- 9 new MessageBox(shell,SWT.ICON_WORKING)
- 10 new MessageBox(shell, SWT.OK)
- 11 new MessageBox(shell, SWT.OK | SWT.CANCEL)
- 12 new MessageBox(shell, SWT.RETRY | SWT.CANCEL)
- 13 new MessageBox(shell, SWT.YES | SWT.NO)
- 14 new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL)
MessageBox: open()
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);
}
}
MessageBox: setMessage(String mess)
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);
}
}
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);
}
}
new MessageBox(Shell parent, int style)
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);
}
}
new MessageBox(shell, SWT.ABORT | SWT.RETRY | SWT.IGNORE)
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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell, SWT.ABORT | SWT.RETRY | SWT.IGNORE);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
new MessageBox(shell,SWT.ICON_ERROR)
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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell,SWT.ICON_INFORMATION);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
new MessageBox(shell,SWT.ICON_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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell,SWT.ICON_QUESTION);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
new MessageBox(shell,SWT.ICON_WARNING)
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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell,SWT.ICON_WARNING);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
new MessageBox(shell,SWT.ICON_WORKING)
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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell,SWT.ICON_WORKING);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
new MessageBox(shell, SWT.OK)
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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell, SWT.OK);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
new MessageBox(shell, SWT.OK | SWT.CANCEL)
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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.CANCEL);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
new MessageBox(shell, SWT.RETRY | SWT.CANCEL)
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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell, SWT.RETRY | SWT.CANCEL);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
new MessageBox(shell, SWT.YES | SWT.NO)
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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell, SWT.YES | SWT.NO);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}
new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL)
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 MainClass {
public static void main(String[] a) {
Display display = new Display();
final Shell shell = new Shell(display);
MessageBox mb = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL);
mb.setText("Message from SWT");
mb.setMessage("message body");
int val = mb.open();
String valString = "";
switch (val) {
case SWT.OK:
valString = "SWT.OK";
break;
case SWT.CANCEL:
valString = "SWT.CANCEL";
break;
case SWT.YES:
valString = "SWT.YES";
break;
case SWT.NO:
valString = "SWT.NO";
break;
case SWT.RETRY:
valString = "SWT.RETRY";
break;
case SWT.ABORT:
valString = "SWT.ABORT";
break;
case SWT.IGNORE:
valString = "SWT.IGNORE";
break;
}
System.out.println(valString);
shell.close();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}