protectedControlcreateContents(Compositeparent){container=newComposite(parent,SWT.NONE);text=newText(container,SWT.BORDER);text.setBounds(105,10,114,23);Labellabel=newLab...
protected Control createContents(Composite parent) {
container = new Composite(parent, SWT.NONE);
text = new Text(container, SWT.BORDER);
text.setBounds(105, 10, 114, 23);
Label label = new Label(container, SWT.NONE);
label.setBounds(10, 13, 54, 18);
label.setText("\u5B66\u53F7");
Button button = new Button(container, SWT.NONE);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
//
Driver d=new org.hsqldb.jdbc.JDBCDriver();
try{
int id=Integer.parseInt(text.getText());
Connection conn =DriverManager.getConnection("jdbc:hsqldb:file:f:/ysc/database/","SA","");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from xscj where ID="+id);//根据id查找数据放入结果集ResultSet
while(rs.next()){
String s= rs.getString(1);//取第一列数据
……}
TableItem item1=new TableItem(table,SWT.NONE);
item1.setText(s);
return button;
展开