eclipse中tableviewer怎么增加复选框
1、在eclipse中新建一个swt-java项目,项目名称javacheck.

2、在项目中新建一个swt application窗口。

3、在shell窗口中增加TableViewer、TableViewerColumn。

4、在TableViewer表格增加数据。
{
TableItem ti=new TableItem(table,SWT.NONE);
ti.setText(0,"安阳");
ti.setText(1,"300百万");
}
{
TableItem ti=new TableItem(table,SWT.NONE);
ti.setText(0,"郑州");
ti.setText(1,"900百万");
}
{
TableItem ti=new TableItem(table,SWT.NONE);
ti.setText(0,"洛阳");
ti.setText(1,"500百万");
}

5、在TableViewer中增加复选框。
TableViewer tableViewer = new TableViewer(shell,SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION);

6、运行项目,效果如图。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:72
阅读量:161
阅读量:127
阅读量:185
阅读量:158