?? tablepanel.java~34~
字號:
package superframe.factionpanels;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import com.borland.dbswing.TableScrollPane;
import com.borland.dbswing.JdbTable;
import com.borland.dx.sql.dataset.Database;
import com.borland.dx.sql.dataset.ConnectionDescriptor;
import com.borland.dx.sql.dataset.QueryDataSet;
import com.borland.dx.sql.dataset.QueryDescriptor;
import com.borland.dx.sql.dataset.Load;
import com.borland.dbswing.JdbNavToolBar;
import com.borland.dbswing.JdbStatusLabel;
import com.borland.dx.dataset.ReadRow;
import com.borland.dx.dataset.RowFilterResponse;
import com.borland.dx.dataset.RowFilterListener;
import javax.swing.JTable;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import superframe.link.SQLRunner;
public class TablePanel extends JPanel {
String sql;
TableScrollPane tableScrollPane1 = new TableScrollPane();
JdbTable jdbTable1 = new JdbTable();
Database database1 = new Database();
QueryDataSet queryDataSet1 = new QueryDataSet();
JdbStatusLabel jdbStatusLabel1 = new JdbStatusLabel();
XYLayout xYLayout1 = new XYLayout();
public TablePanel(){
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void resetTable(String sql){
//this.sql=sql;
if(sql==null)return;
queryDataSet1.closeStatement();
queryDataSet1.setQuery(new QueryDescriptor(database1, sql, null, true,
Load.ALL));
queryDataSet1.refresh();
}
private void jbInit() throws Exception {
//if(this.sql==null)return;
this.setLayout(xYLayout1);
database1.setConnection(new ConnectionDescriptor(
SQLRunner.url,SQLRunner.userID, SQLRunner.password, false,
SQLRunner.jdbcDriver));
database1.setDatabaseName("");
if(sql!=null)
queryDataSet1.setQuery(new QueryDescriptor(database1, sql, null, true,
Load.ALL));
jdbTable1.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
jdbTable1.setDataSet(queryDataSet1);
jdbStatusLabel1.setText("??