swt 点击按钮往 table 中添加数据 tableEditor的使用
来源:互联网 发布:vb进度条控件英文 编辑:程序博客网 时间:2024/05/02 00:07
package com.ln.epos.ui.view;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import com.swtdesigner.SWTResourceManager;
public class testCheck {
public static final Display display = new Display();
public static Shell shell = display.getActiveShell();
/**
* @param args
*/
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(500, 375);
shell.setText("FORM");
shell.setBackground(new Color(Display.getCurrent(), 254, 250, 232));
shell.setSize(new Point(214, 237));
shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
shell.setLayout(null);
final Table table = new Table(shell, SWT.BORDER | SWT.FULL_SELECTION);
table.setBounds(0, 0, 206, 129);
table.setHeaderVisible(true);
table.setFont(SWTResourceManager.getFont("幼圆", 9, SWT.NORMAL));
table.setLinesVisible(true);
TableColumn tableColumn0 = new TableColumn(table, SWT.CENTER);
tableColumn0.setWidth(46);
tableColumn0.setText("1");
TableColumn tableColumn1 = new TableColumn(table, SWT.CENTER);
tableColumn1.setWidth(52);
tableColumn1.setText("2");
TableColumn tableColumn2 = new TableColumn(table, SWT.CENTER);
tableColumn2.setWidth(57);
tableColumn2.setText("3");
TableColumn tableColumn3 = new TableColumn(table, SWT.NONE);
tableColumn3.setWidth(47);
tableColumn3.setText("4");
Button buttonBottom = new Button(shell, SWT.NONE);
buttonBottom.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TableItem ti = new TableItem(table, SWT.NONE);
ti.setText(0, "aaa");
ti.setText(1, "bbb");
TableEditor tableEditor = new TableEditor(table);
tableEditor.grabHorizontal = true;
Button chkboxApp = new Button(table, SWT.CHECK | SWT.CENTER);
chkboxApp.setBackground(SWTResourceManager
.getColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
tableEditor.setEditor(chkboxApp, ti, 2);
TableEditor tableEditor2 = new TableEditor(table);
tableEditor2.grabHorizontal = true;
Button chkboxApp2 = new Button(table, SWT.CHECK | SWT.CENTER);
chkboxApp2.setBackground(SWTResourceManager
.getColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
tableEditor2.setEditor(chkboxApp2, ti, 3);
}
});
buttonBottom.setBounds(132, 163, 61, 22);
buttonBottom.setText("AddItem");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
- swt 点击按钮往 table 中添加数据 tableEditor的使用
- SWT中在表格上添加 控件,TableEditor的使用
- swt table中添加入力框
- SWT - Table的使用
- SWT如何用代码使用按钮的点击
- EasyUI table中点击按钮获取当前行数据
- 在swt中使用table
- JvaScript--使用js添加数据,点击按钮,将内容放入表格中
- 激发按钮点击事件为listview中添加数据
- SWT中按钮的监听器
- 安卓ListView的Item中添加按钮后,点击Button获取点击行的TextView文本数据
- 点击按钮往word文件中固定地方添加数据库数据再下载
- Angularjs中table中实现点击td中按钮不触发tr的点击事件
- SWT Table数据
- asp.net后台代码实现点击按钮动态添加table的一行
- 为easyUI的table表格添加点击按钮并弹出图片
- 点击添加按钮关闭窗口,再点击修改按钮,提交后携带的是添加的数据
- tableView中添加按钮触发不了点击事件的解决办法
- Struts原理与实践
- MXML是什么?
- GIS研究方向
- 2008/4/23 关于事业的思考
- ms sql server 2005 安装在多核机器上,启动失败的问题
- swt 点击按钮往 table 中添加数据 tableEditor的使用
- 2008/4/24 《不对称创新》读后感
- 2008/9/27 采访稿:《开放API》
- HTTP协议头分析
- 2008/10/8 从国防级软件开发的一点数据管窥高质量软件开发
- WINCE下串口测试编程
- delphi 编写的com 对象 用php调用的实例
- 新年新的生活
- webservice