eclipse的swt插件的控件
来源:互联网 发布:sql语句升序降序 编辑:程序博客网 时间:2024/04/30 01:58
SWT 各控件(文本框、消息框、组合框、表)的使用 持续更新中。。。
2009-10-25 20:25
SWT text(文本框)
Text text ;
// 添加单行文本框
text =new Text(shell, SWT.BORDER);
// 添加右对齐单行文本框
text =new Text(shell, SWT.RIGHT | SWT.BORDER);
// 添加以密码形式显示的文本框
text =new Text(shell, SWT.PASSWORD | SWT.BORDER);
// 添加只读文本框
text =new Text(shell, SWT.READ_ONLY | SWT.BORDER).setText("Read Only");
SWT messagebox:(消息框)
MessageBox msgbox=new MessageBox(shell,SWT.ICON_WARNING|SWT.OK|SWT.CANCEL);
msgbox.setMessage(“Please ”); //设置消息内容
if(msgbox.open()==SWT.OK)
{
.....
return;
}
常用的消息框类型有:SWT.ICON_WARNING, SWT.ICON_INFORMATION
常用组合:SWT.YES|SWT.NO , SWT.OK|SWT.CANCEL
SWT ComboBox:(组合框)
Combo comboNameOfUnit;
String szTmp ="“要添加的内容";
comboNameOfUnit.add(szTmp ); //添加要显示的内容
comboNameOfUnit.select(0); //默认选择第一项
SWT TABLE:(表)
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
//创建表
Table tableSearch = new Table(groupDisplay, SWT.BORDER); //设置表的基本属性,如有边框
tableSearch.setLinesVisible(true);
tableSearch.setHeaderVisible(true);
tableSearch.setBounds(10, 26, 454, 101);
//删除表的记录
tableSearch.removeAll();
//删除表的所有列
int nTableColumn = tableSearch.getColumnCount();
for (int i=0; i<nTableColumn; i++)
{
tableSearch.getColumn(0).dispose();
}
//增加列
String[] columnHead={"id号",“名字”};
int COLUMN_WIDTH = 65;
TableColumn[] tableColumn = new TableColumn[columnHead.length];
for (int i=0; i<columnHead.length; i++)
{
//增加记录
String[] szValue={"122","张三"};
TableItem tableItem = new TableItem(tableSearch, SWT.NONE);
tableItem.setText(szValue); //设置将要显示的记录String数组
Text text ;
// 添加单行文本框
text =new Text(shell, SWT.BORDER);
// 添加右对齐单行文本框
text =new Text(shell, SWT.RIGHT | SWT.BORDER);
// 添加以密码形式显示的文本框
text =new Text(shell, SWT.PASSWORD | SWT.BORDER);
// 添加只读文本框
text =new Text(shell, SWT.READ_ONLY | SWT.BORDER).setText("Read Only");
SWT messagebox:(消息框)
MessageBox msgbox=new MessageBox(shell,SWT.ICON_WARNING|SWT.OK|SWT.CANCEL);
msgbox.setMessage(“Please ”); //设置消息内容
if(msgbox.open()==SWT.OK)
{
.....
return;
}
常用的消息框类型有:SWT.ICON_WARNING, SWT.ICON_INFORMATION
常用组合:SWT.YES|SWT.NO , SWT.OK|SWT.CANCEL
SWT ComboBox:(组合框)
Combo comboNameOfUnit;
String szTmp ="“要添加的内容";
comboNameOfUnit.add(szTmp ); //添加要显示的内容
comboNameOfUnit.select(0); //默认选择第一项
SWT TABLE:(表)
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
//创建表
Table tableSearch = new Table(groupDisplay, SWT.BORDER); //设置表的基本属性,如有边框
tableSearch.setLinesVisible(true);
tableSearch.setHeaderVisible(true);
tableSearch.setBounds(10, 26, 454, 101);
//删除表的记录
tableSearch.removeAll();
//删除表的所有列
int nTableColumn = tableSearch.getColumnCount();
for (int i=0; i<nTableColumn; i++)
{
tableSearch.getColumn(0).dispose();
}
//增加列
String[] columnHead={"id号",“名字”};
int COLUMN_WIDTH = 65;
TableColumn[] tableColumn = new TableColumn[columnHead.length];
for (int i=0; i<columnHead.length; i++)
{
tableColumn[i] = new TableColumn(tableSearch, SWT.NONE); //绑定到表tableSearch
tableColumn[i].setText(columnHead[i]); //设置属性名
tableColumn[i].setWidth(COLUMN_WIDTH); //设置每列的宽度
}tableColumn[i].setText(columnHead[i]); //设置属性名
tableColumn[i].setWidth(COLUMN_WIDTH); //设置每列的宽度
//增加记录
String[] szValue={"122","张三"};
TableItem tableItem = new TableItem(tableSearch, SWT.NONE);
tableItem.setText(szValue); //设置将要显示的记录String数组
- eclipse的swt插件的控件
- 下载Eclipse的SWT插件
- Eclipse中SWT插件的安装
- Eclipse开发Swing, SWT, RCP的插件
- SWT 的插件下载
- 自定义的SWT控件
- swt控件的使用
- SWT的标签控件
- Java(swt+jface) 开发的Eclipse插件下载
- Eclipse的SWT/Swing插件---Jigloo注册码备忘
- OpenGL的SWT的控件
- Eclipse安装swt插件
- Eclipse安装swt插件
- eclipse 安装 swt 插件
- Eclipse安装swt插件
- SWT控件的computeSize方法
- eclipse中swt的起步
- Eclipse的SWT测试模板
- oracle union union all intersect minus
- 适合做手机铃声的81首歌
- MyEclipse在线安装SVN步骤
- aix root 密码重新设置(原创)
- Prepare(2)
- eclipse的swt插件的控件
- 【转帖】C 语言的谜题
- redo log file
- Hook其他程序中的StringGrid的内容(内牛满面,终于找到了。)
- OPC标准
- Linux查看CPU信息、机器型号等硬件信息
- 数据表中添加列
- (转)linux相关技术
- struts2 EL