SWT DIALOG
来源:互联网 发布:煤矿系统故障模拟软件 编辑:程序博客网 时间:2024/05/08 09:39
1、MessageBox,消息对话框
可定制的对话框样式包括:
标题栏:setText()
消息提示:setMessage()
消息图标类型:style属性,有:SWT.ICON_ERROR,SWT.ICON_INFORMATION,SWT.ICON_QUESTION,SWT.ICON_WARNING,SWT.ICON_WORKING
按钮类型:style属性,有:SWT.OK,SWT.OK | SWT.CANCEL,SWT.YES | SWT.NO,SWT.YES | SWT.NO | SWT.CANCEL,SWT.RETRY | SWT.CANCEL,SWT.ABORT | SWT.RETRY | SWT.IGNORE
对话框返回值:int open(),返回的是点击的按钮对应的int值。
示例:
MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION |SWT.YES | SWT.NO);
messageBox.setMessage(”Is this question simple?”);
int rc = messageBox.open();
2、ColorDialog,选择颜色对话框
ColorDialog dlg = new ColorDialog(shell);
RGB rgb = dlg.open();
if (rgb != null) {
Color color = new Color(shell.getDisplay(), rgb);
}
3、DirectoryDialog,文件夹选择对话框
DirectoryDialog dlg = new DirectoryDialog(shell);
dlg.setFilterPath(text.getText());
dlg.setText(”SWT’s DirectoryDialog”);
dlg.setMessage(”Select a directory”);
String selectedDirectory = dlg.open();
4、FileDialog,文件选择对话框
FileDialog dlg = new FileDialog(shell, SWT.OPEN);
String fileName = dlg.open();
if (fileName != null) {
// Open the file
}
对话框标题栏:void setText(String text)
文件后缀名过滤:void setFilterExtensions (String[] extensions)
缺省路径及文件名:void setFilterPath(String string)
返回值:String[] getFileNames() / String getFileName()
- SWT DIALOG
- swt/jface 自定义 Dialog
- swt/jface dialog
- swt/jface 自定义 Dialog
- swt/jface 自定义 Dialog
- swt/jface 自定义 Dialog
- SWT/Jface Dialog
- SWT的自定义Dialog
- swt/jface 自定义 Dialog
- swt 关闭对话框 关闭dialog
- Swt/Jface中提供的dialog
- Swt/Jface中提供的dialog
- Swt/Jface中提供的dialog
- Swt/Jface中提供的dialog
- Swt/Jface的dialog 分类总结&详细编程
- SWT
- SWT
- swt
- 关于动态规划(入门篇)
- UML简介
- 视频行业面临崩盘危机
- 原创---关于实现comparable接口的排序例子
- 浅谈JavaScript框架设计
- SWT DIALOG
- MediaElement详解
- 解读巨人和腾讯牵手——企业个性转换成实用价值
- WinMobile学习笔记三
- 解读暴风和央视联姻
- 2009年全球新装光伏发电系统将达到4GW
- 阿里巴巴如何助万网斩获市场份额
- 小型太阳能电站有望进入家庭
- JConsole连接Tomcat使用注意点