在Eclipse平臺中有很消息對話框,下面給出幾種簡單的消息對話框的實現:
//需要導入的類:
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.PlatformUI;
//常規信息提示框:
MessageDialog.openInformation (
PlatformUI.getWorkbench().getDisplay().getActiveShell(),
"這是信息提示框例子",
"這裏可以寫一些具體的提示信息!");
//錯誤信息提示框:
MessageDialog.openError (
PlatformUI.getWorkbench().getDisplay().getActiveShell(),
"這是信息提示框例子",
"這裏可以寫一些具體的提示信息!");
//警告信息提示框:
MessageDialog.openWarning(
PlatformUI.getWorkbench().getDisplay().getActiveShell(),
"這是信息提示框例子",
"這裏可以寫一些具體的提示信息!");