⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit_reckoning.java~15~

📁 在个一个诊所系统,实现数据的查询和删除等的操作.
💻 JAVA~15~
字号:
package clinique;

import java.awt.*;

import javax.swing.*;
import java.awt.Rectangle;
import com.borland.dx.sql.dataset.Database;
import com.borland.dx.sql.dataset.QueryDataSet;
import com.borland.dbswing.JdbTable;
import com.borland.dx.sql.dataset.ConnectionDescriptor;
import com.borland.dx.sql.dataset.Load;
import com.borland.dx.sql.dataset.QueryDescriptor;
import javax.swing.BorderFactory;
import java.awt.Font;
import com.borland.dx.dataset.Column;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class edit_reckoning extends JPanel {
    public edit_reckoning() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.setLayout(null);
        jScrollPane1.setBorder(BorderFactory.createEtchedBorder());
        jScrollPane1.setBounds(new Rectangle(9, 10, 662, 231));
        database1.setConnection(new ConnectionDescriptor(
                "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=clinique",
                "sa", "", false, "com.microsoft.jdbc.sqlserver.SQLServerDriver"));
        queryDataSet1.setQuery(new QueryDescriptor(database1,
                "select * from reckoning", null, true, Load.ALL));
        jdbTable1.setDataSet(queryDataSet1);
        jdbTable1.setEditable(false);
        jButton1.setBounds(new Rectangle(371, 13, 90, 23));
        jButton1.setText("提交修改");
        jButton2.setBounds(new Rectangle(486, 13, 85, 23));
        jButton2.setText("取消");
        look.setBounds(new Rectangle(259, 13, 86, 23));
        look.setText("查询");
        look.addActionListener(new edit_reckoning_look_actionAdapter(this));
        lookname.setBounds(new Rectangle(149, 15, 77, 20));
        jLabel1.setText("姓名查找:");
        jLabel1.setBounds(new Rectangle(76, 16, 73, 15));
        jPanel1.setBorder(BorderFactory.createEtchedBorder());
        jPanel1.setBounds(new Rectangle(9, 352, 662, 47));
        jPanel1.setLayout(null);
        jPanel2.setBorder(BorderFactory.createEtchedBorder());
        jPanel2.setBounds(new Rectangle(57, 44, 680, 405));
        jPanel2.setLayout(null);
        jLabel2.setFont(new java.awt.Font("宋体", Font.BOLD, 15));
        jLabel2.setText("帐单信息修改");
        jLabel2.setBounds(new Rectangle(28, 15, 99, 25));
        column1.setColumnName("id");
        column1.setDataType(com.borland.dx.dataset.Variant.INT);
        column1.setRowId(true);
        column1.setTableName("reckoning");
        column1.setWidth(9);
        column1.setServerColumnName("id");
        column1.setSqlType(4);
        column2.setColumnName("patientname");
        column2.setDataType(com.borland.dx.dataset.Variant.STRING);
        column2.setPrecision(50);
        column2.setTableName("reckoning");
        column2.setWidth(10);
        column2.setServerColumnName("patientname");
        column2.setSqlType(1);
        column3.setColumnName("medicine");
        column3.setDataType(com.borland.dx.dataset.Variant.STRING);
        column3.setPrecision(100);
        column3.setTableName("reckoning");
        column3.setWidth(10);
        column3.setServerColumnName("medicine");
        column3.setSqlType(1);
        column4.setColumnName("price");
        column4.setDataType(com.borland.dx.dataset.Variant.BIGDECIMAL);
        column4.setPrecision(19);
        column4.setScale(4);
        column4.setTableName("reckoning");
        column4.setWidth(10);
        column4.setServerColumnName("price");
        column4.setSqlType(3);
        column5.setColumnName("number");
        column5.setDataType(com.borland.dx.dataset.Variant.INT);
        column5.setTableName("reckoning");
        column5.setWidth(9);
        column5.setServerColumnName("number");
        column5.setSqlType(4);
        column6.setColumnName("doctor");
        column6.setDataType(com.borland.dx.dataset.Variant.STRING);
        column6.setPrecision(50);
        column6.setTableName("reckoning");
        column6.setWidth(10);
        column6.setServerColumnName("doctor");
        column6.setSqlType(1);
        jPanel3.setBorder(BorderFactory.createEtchedBorder());
        jPanel3.setBounds(new Rectangle(9, 251, 340, 98));
        jPanel3.setLayout(null);
        jLabel3.setText("病人姓名:");
        jLabel3.setBounds(new Rectangle(66, 14, 68, 15));
        jLabel4.setText("主治医生:");
        jLabel4.setBounds(new Rectangle(71, 25, 72, 15));
        jLabel5.setText("所用药品:");
        jLabel5.setBounds(new Rectangle(66, 44, 71, 15));
        jLabel6.setText("帐单日期:");
        jLabel6.setBounds(new Rectangle(71, 60, 68, 15));
        jLabel7.setText("药瓶单价:");
        jLabel7.setBounds(new Rectangle(65, 72, 68, 15));
        jPanel4.setBorder(BorderFactory.createEtchedBorder());
        jPanel4.setBounds(new Rectangle(355, 251, 316, 98));
        jPanel4.setLayout(null);
        jTextField2.setBounds(new Rectangle(178, 10, 91, 20));
        jTextField3.setBounds(new Rectangle(178, 39, 91, 20));
        jTextField4.setBounds(new Rectangle(177, 68, 91, 20));
        jTextField5.setBounds(new Rectangle(170, 20, 77, 20));
        jTextField6.setBounds(new Rectangle(170, 56, 77, 20));
        jPanel1.add(jLabel1);
        jPanel1.add(lookname);
        jPanel1.add(look);
        jPanel1.add(jButton1);
        jPanel1.add(jButton2);
        jPanel2.add(jScrollPane1);
        jScrollPane1.getViewport().add(jdbTable1);
        jPanel3.add(jLabel7);
        jPanel3.add(jLabel5);
        jPanel3.add(jLabel3);
        jPanel3.add(jTextField4);
        jPanel3.add(jTextField2);
        jPanel3.add(jTextField3);
        jPanel2.add(jPanel4);
        jPanel4.add(jTextField5);
        jPanel4.add(jLabel4);
        jPanel4.add(jLabel6);
        jPanel4.add(jTextField6);
        jPanel2.add(jPanel1);
        jPanel2.add(jPanel3);
        this.add(jLabel2);
        this.add(jPanel2);
        queryDataSet1.setColumns(new Column[] {column1, column2, column3,
                                 column4, column5, column6});
    }

    JScrollPane jScrollPane1 = new JScrollPane();
    Database database1 = new Database();
    QueryDataSet queryDataSet1 = new QueryDataSet();
    JdbTable jdbTable1 = new JdbTable();
    JButton jButton1 = new JButton();
    JButton jButton2 = new JButton();
    JButton look = new JButton();
    JTextField lookname = new JTextField();
    JLabel jLabel1 = new JLabel();
    JPanel jPanel1 = new JPanel();
    JPanel jPanel2 = new JPanel();
    JLabel jLabel2 = new JLabel();
    Column column1 = new Column();
    Column column2 = new Column();
    Column column3 = new Column();
    Column column4 = new Column();
    Column column5 = new Column();
    Column column6 = new Column();
    JPanel jPanel3 = new JPanel();
    JLabel jLabel3 = new JLabel();
    JLabel jLabel4 = new JLabel();
    JLabel jLabel5 = new JLabel();
    JLabel jLabel6 = new JLabel();
    JLabel jLabel7 = new JLabel();
    JPanel jPanel4 = new JPanel();
    JTextField jTextField2 = new JTextField();
    JTextField jTextField3 = new JTextField();
    JTextField jTextField4 = new JTextField();
    JTextField jTextField5 = new JTextField();
    JTextField jTextField6 = new JTextField();
    public void look_actionPerformed(ActionEvent e) {
        if(lookname.getText().length()==0)
        {
            JOptionPane.showMessageDialog(null,"请输入你要查询的关键字!");
            lookname.requestFocus();
        }
        else if(!lookname.getText().equals(""))
        {
            queryDataSet1.close();
            queryDataSet1.setQuery(new QueryDescriptor(database1,
                    "select * from reckoning where patientname=\'" +
                    lookname.getText() + "\'", null, true,
                    Load.ALL));
            jdbTable1.setDataSet(queryDataSet1);
            queryDataSet1.refresh();
            if(queryDataSet1.getRowCount()==0)
            {
                JOptionPane.showMessageDialog(null,"你要查询的病人信息不存在");
            }
        }
    }
}


class edit_reckoning_look_actionAdapter implements ActionListener {
    private edit_reckoning adaptee;
    edit_reckoning_look_actionAdapter(edit_reckoning adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.look_actionPerformed(e);
    }
}

⌨️ 快捷键说明

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