package database;
import java.awt.*;
import javax.swing.*;
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.Load;
import com.borland.dx.sql.dataset.QueryDescriptor;
import com.borland.dbswing.DBDisposeMonitor;
import com.borland.dbswing.TableScrollPane;
import java.awt.BorderLayout;
import com.borland.dbswing.JdbLabel;
import com.borland.dbswing.JdbNavField;
import java.awt.Dimension;
import com.borland.dbswing.JdbStatusLabel;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class BasicDBAppDemo
extends JFrame {
BorderLayout borderLayout1 = new BorderLayout();
Database database1 = new Database();
QueryDataSet queryDataSet1 = new QueryDataSet();
DBDisposeMonitor dBDisposeMonitor1 = new DBDisposeMonitor();
TableScrollPane tableScrollPane1 = new TableScrollPane();
JdbLabel jdbLabel1 = new JdbLabel();
JdbNavField jdbNavField1 = new JdbNavField();
JLabel jLabel1 = new JLabel();
JdbStatusLabel jdbStatusLabel1 = new JdbStatusLabel();
public BasicDBAppDemo() {
try {
jbInit();
}
catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
getContentPane().setLayout(borderLayout1);
database1.setConnection(new ConnectionDescriptor(
"jdbc:borland:dslocal:E:\\bysj\\bysj\\src\\bysj\\bysj.jds", "test",
"1234", false, "com.borland.datastore.jdbc.DataStoreDriver"));
queryDataSet1.setQuery(new QueryDescriptor(database1,
"SELECT PRODUCT.ID,PRODUCT.NAME,PRODUCT.AMOUNT,PRODUCT.PRICE FROM " +
"DEFAULT_SCHEMA.PRODUCT", null, true,
Load.ALL));
dBDisposeMonitor1.setDataAwareComponentContainer(this);
jLabel1.setText("Find");
jdbNavField1.setPreferredSize(new Dimension(125, 20));
jdbNavField1.setText("jdbNavField1");
jdbNavField1.setColumnName("NAME");
jdbNavField1.setDataSet(queryDataSet1);
jdbLabel1.setText("jdbLabel1");
jdbLabel1.setDataSet(queryDataSet1);
this.getContentPane().add(jdbLabel1, java.awt.BorderLayout.NORTH);
jdbStatusLabel1.setText("jdbStatusLabel1");
this.getContentPane().add(jLabel1, java.awt.BorderLayout.WEST);
this.getContentPane().add(jdbStatusLabel1, java.awt.BorderLayout.CENTER);
this.getContentPane().add(tableScrollPane1, java.awt.BorderLayout.SOUTH);
this.getContentPane().add(jdbNavField1, java.awt.BorderLayout.EAST);
}
public static void main(String[] args) {
BasicDBAppDemo basicdbappdemo = new BasicDBAppDemo();
}
}
[此贴子已经被作者于2007-4-23 23:26:05编辑过]