欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

recordsearchdialog.java~1~

eidtplus注册码.txt eidtplus注册码.txt
JAVA~1~
字号:
package parkingsystem;

import java.awt.*;
import javax.swing.*;
import java.awt.BorderLayout;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import com.borland.dbswing.TableScrollPane;
import javax.swing.BorderFactory;
import java.awt.Color;
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.Load;
import com.borland.dx.sql.dataset.QueryDescriptor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class RecordSearchDialog
    extends JDialog {
  JPanel panel1 = new JPanel();
  BorderLayout borderLayout1 = new BorderLayout();
  JSplitPane jSplitPane1 = new JSplitPane();
  JPanel jPanel1 = new JPanel();
  JPanel jPanel2 = new JPanel();
  XYLayout xYLayout2 = new XYLayout();
  JPanel jPanel3 = new JPanel();
  TableScrollPane tableScrollPane1 = new TableScrollPane();
  JdbTable jdbTable1 = new JdbTable();
  XYLayout xYLayout1 = new XYLayout();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JComboBox jComboBox1 = new JComboBox();
  JTextField jTextField1 = new JTextField();
  JButton jButton1 = new JButton();
  BorderLayout borderLayout2 = new BorderLayout();
  TableScrollPane tableScrollPane2 = new TableScrollPane();
  JdbTable jdbTable2 = new JdbTable();
  Database database1 = new Database();
  QueryDataSet queryDataSet1 = new QueryDataSet();
  QueryDataSet queryDataSet2 = new QueryDataSet();
  public RecordSearchDialog(Frame owner, String title, boolean modal) {
    super(owner, title, modal);
    try {
      setDefaultCloseOperation(DISPOSE_ON_CLOSE);
      jbInit();
      pack();
    }
    catch (Exception exception) {
      exception.printStackTrace();
    }
  }

  public RecordSearchDialog() {
    this(new Frame(), "RecordSearchDialog", false);
  }

  private void jbInit() throws Exception {
    jComboBox1.addItem("");
    jComboBox1.addItem("按卡号查询");
    jComboBox1.addItem("按车牌号查询");
    panel1.setLayout(borderLayout1);
    jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
    jPanel1.setLayout(xYLayout2);
    jPanel3.setLayout(xYLayout1);
    jLabel1.setText("查询条件:");
    jLabel2.setText("关键字:");
    jButton1.setText("执行查询");
    jButton1.addActionListener(new RecordSearchDialog_jButton1_actionAdapter(this));
    jPanel3.setToolTipText("");
    jPanel3.setInputVerifier(null);
    jPanel2.setToolTipText("fdsf");
    jPanel2.setLayout(borderLayout2);
    database1.setConnection(new ConnectionDescriptor(
        "jdbc:microsoft:sqlserver://Localhost:1433;DatabaseName=parkingdb",
        "sa", "123456", false, "com.microsoft.jdbc.sqlserver.SQLServerDriver"));
    queryDataSet1.setQuery(new QueryDescriptor(database1,
        "select CardID,CarNum,UserName,InTIme,OutTime from event,users where " +
                                               "event.UserID=users.UserID and CardID=0", null, true,
                                               Load.ALL));
    queryDataSet2.setQuery(new QueryDescriptor(database1,
                                               "select * from CarOwner", null, true,
                                               Load.ALL));
    jdbTable1.setDataSet(queryDataSet1);
    jdbTable2.setDataSet(queryDataSet2);
    this.getContentPane().add(panel1, java.awt.BorderLayout.CENTER);
    panel1.add(jSplitPane1, java.awt.BorderLayout.CENTER);
    jSplitPane1.add(jPanel1, JSplitPane.TOP);
    jSplitPane1.add(jPanel2, JSplitPane.BOTTOM);
    jPanel2.add(tableScrollPane2, java.awt.BorderLayout.CENTER);
    tableScrollPane2.getViewport().add(jdbTable2);
    jPanel1.add(jPanel3, new XYConstraints(0, 0, 475, 60));
    jPanel1.add(tableScrollPane1, new XYConstraints(0, 63, 474, 198));
    tableScrollPane1.getViewport().add(jdbTable1);
    jPanel3.add(jButton1, new XYConstraints(376, 16, 82, 24));
    jPanel3.add(jLabel2, new XYConstraints(201, 16, 55, 20));
    jPanel3.add(jTextField1, new XYConstraints(270, 16, 82, 23));
    jPanel3.add(jComboBox1, new XYConstraints(89, 11, 107, -1));
    jPanel3.add(jLabel1, new XYConstraints(21, 16, 64, 20));
    jSplitPane1.setDividerLocation(260);
    queryDataSet2.setMasterLink(new com.borland.dx.dataset.MasterLinkDescriptor(
        queryDataSet1, new String[] {"CardID"}, new String[] {"CardID"}, false, false, false));
  }

  public void jButton1_actionPerformed(ActionEvent actionEvent) {
    queryDataSet1.close();
    queryDataSet2.close();
    String keywords=jTextField1.getText().trim();
    String query="";
    if(jComboBox1.getSelectedItem().equals("按车牌号查询")){
      query="select CardID,CarNum,UserName,InTime,OutTime from event,users where event.UserID=users.UserID and CarNum like '%"+keywords+"%'";

    }else if(jComboBox1.getSelectedItem().equals("按卡号查询")){
      query="select CardID,CarNum,UserName,InTime,OutTime from event,users where event.UserID=users.UserID and CardID like '%"+keywords+"%'";

    }
    queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1,query,null,true,Load.ALL));
    queryDataSet1.refresh();
  }
}

class RecordSearchDialog_jButton1_actionAdapter
    implements ActionListener {
  private RecordSearchDialog adaptee;
  RecordSearchDialog_jButton1_actionAdapter(RecordSearchDialog adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent actionEvent) {
    adaptee.jButton1_actionPerformed(actionEvent);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -