table_short = new Table (composite_short, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
GridData gd_table = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_table.heightHint = 104;
gd_table.widthHint = 639;
table_short.setLayoutData(gd_table);
table_short.setLinesVisible(true);
table_short.setHeaderVisible(true);
table_short.setSize (100, 100);
TableColumn tableColumn = new TableColumn(table_short, SWT.NONE);
tableColumn.setWidth(20);
tableColumn.setText("");
TableColumn tableColumn_1 = new TableColumn(table_short, SWT.NONE);
tableColumn_1.setWidth(100);
tableColumn_1.setText("a");
TableColumn tableColumn_2 = new TableColumn(table_short, SWT.NONE);
tableColumn_2.setWidth(100);
tableColumn_2.setText("b");
TableColumn tableColumn_3 = new TableColumn(table_short, SWT.NONE);
tableColumn_3.setWidth(100);
tableColumn_3.setText("c");
TableColumn tableColumn_4 = new TableColumn(table_short, SWT.NONE);
tableColumn_4.setWidth(100);
tableColumn_4.setText("d");
TableColumn tableColumn_5 = new TableColumn(table_short, SWT.NONE);
tableColumn_5.setWidth(100);
tableColumn_5.setText("e");
TableColumn tableColumn_6 = new TableColumn(table_short, SWT.NONE);
tableColumn_6.setWidth(100);
tableColumn_6.setText("f");
table_short.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event event) {
String string = event.detail == SWT.CHECK ? "Checked" : "Selected";
TableItem[] titem = table_short.getItems();
for(int i = 0; i < titem.length; i++){
if(!event.item.equals(titem[i])){
titem[i].setChecked(false);
}
}
System.out.println (event.item + " " + string);
}
});
for (int i=0; i<5; i++) {
TableItem item = new TableItem (table_short, SWT.NONE);
item.setText (new String[]{"", "item1"+i,"item2"+i,"item3"+i,"item4"+i,"item5"+i,"item6"+i,});
}
分享到:
相关推荐
swt table 实现换行
SWT原生按钮不够美观,本案例实现自定义圆形按钮,代码可直接下载使用。
SWT Table 单元格编辑实例代码
工具类实现了分页,虽然还有些欠缺,如在搜索栏和导出菜单未考虑分页的情况
基于java语言,应用eclipse SWT类库+Jdbc+SqlServer数据库,实现同一界面展示散点图和数据表格展示,满足跨平台、安全等软件应用需求。
SWT表格管理类,包括表头排序事件,table宽度自适应事件,隔行颜色事件
修改类库中的tooltip、单元格的复制与粘贴
Java使用SWT JFreeChart控件实现的小游戏.zipJava使用SWT JFreeChart控件实现的小游戏.zipJava使用SWT JFreeChart控件实现的小游戏.zipJava使用SWT JFreeChart控件实现的小游戏.zipJava使用SWT JFreeChart控件实现的...
使Excel嵌入到SWT窗口中 使用的Eclipse版本:3.3.1 使用的jdk版本:5.0
NULL 博文链接:https://1299020954.iteye.com/blog/2181896
SWT无边框窗体实现鼠标拖动移动,并添加右键菜单关闭功能
NULL 博文链接:https://chenyu-hz.iteye.com/blog/1842256
利用SWTUtils实现了分页,SWT Table技术,测试通过,是个小工具,完整源码,希望对大家有帮助。
Button,Label,Text,Combo,List,Menu,Composite,Group,TabItem,FillLayout,SWT监听事件的使用等等例子!
Java使用SWT技术实现跳棋游戏,若有SWT编程基础,那最好了,新手可能看代码有些难度哦。
NULL 博文链接:https://liuxiaobin1023-163-com.iteye.com/blog/1144212
为表列添加排序功能,列适应表格宽度,添加光棒以及各行颜色差效果,背景颜色,隔行换色
java swt版本的qq可以实现的功能