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

📄 newcar.java~53~

📁 出租车管理系统,为本人毕业设计. 还请大家多多指教了
💻 JAVA~53~
📖 第 1 页 / 共 3 页
字号:
        this.setLocation(170, 50);
        this.setVisible(true);
        addWindowListener(new WindowAdapter() {
            public void WindowClosing(WindowEvent e) {
                if(db!=null)
                db.closeConnection();
                dispose();
            }
        });
    }

    DataBaseManager db=null;
    ResultSet r;
    XYLayout xYLayout1 = new XYLayout();
    Border border1 = BorderFactory.createEtchedBorder(EtchedBorder.RAISED,
            Color.white, new Color(148, 145, 140));
    JLabel jLabel3 = new JLabel();
    JLabel jLabel4 = new JLabel();
    JLabel jLabel1 = new JLabel();
    JTextField carid_t = new JTextField();
    JTextField factory_t = new JTextField();
    JTextField actionid_t = new JTextField();
    JLabel jLabel2 = new JLabel();
    JTextField under_t = new JTextField();
    JLabel jLabel5 = new JLabel();
    JComboBox jComboBox1 = new JComboBox();
    JLabel jLabel6 = new JLabel();
    JTextField businessid_t = new JTextField();
    JLabel jLabel7 = new JLabel();
    JLabel jLabel8 = new JLabel();
    JTextField countmoney_t = new JTextField();
    JLabel jLabel9 = new JLabel();
    JTextField lightid_t = new JTextField();
    JLabel jLabel10 = new JLabel();
    JTextField drivername_t = new JTextField();
    JLabel jLabel11 = new JLabel();
    JTextField driveid_t = new JTextField();
    JLabel jLabel12 = new JLabel();
    JLabel jLabel13 = new JLabel();
    JLabel jLabel14 = new JLabel();
    JLabel jLabel15 = new JLabel();
    JLabel jLabel16 = new JLabel();
    JLabel jLabel17 = new JLabel();
    JLabel jLabel18 = new JLabel();
    JComboBox jComboBox2 = new JComboBox();
    JLabel jLabel19 = new JLabel();
    JTextField breaklowcount_t = new JTextField();
    JButton jButton1 = new JButton(new ImageIcon("image\\163.gif"));
    JButton jButton2 = new JButton(new ImageIcon("image\\48.gif"));
    JButton jButton3 = new JButton(new ImageIcon("image\\back.gif"));
    JTextField protecthour_t = new JTextField();
    JTextField jTextField1 = new JTextField();
    JTextField yingdate = new JTextField();
    JTextField yeardate = new JTextField();
    JTextField toudate = new JTextField();
    JTextField nextyingdate = new JTextField();
    JTextField nextyeardate = new JTextField();
    public void jTextField6_actionPerformed(ActionEvent e) {

    }

    public void jButton1_actionPerformed(ActionEvent e) {
        db=new DataBaseManager();
        String str = "select * from car where 车牌号='"+carid_t.getText() .trim()+"'" ;
        try {
//            r = db.getResult(str);
//            r.first();
            if (db.getResult(str).first()) {
                JOptionPane.showMessageDialog(null, "该车辆已存在!");
                carid_t.setText("");
                factory_t.setText("");
                actionid_t.setText("");
                under_t.setText("");
                businessid_t.setText("");
                countmoney_t.setText("");
                lightid_t.setText("");
                drivername_t.setText("");
                yeardate.setText("");
                nextyeardate.setText("");
                yingdate.setText("");
                nextyingdate.setText("");
                toudate.setText("");
                driveid_t.setText("");
                breaklowcount_t.setText("0");
                protecthour_t.setText("");
            } else {
                str = "insert into car(车牌号,制造商,发动机号,底盘编号,燃油类型,营运证号,计价器号,顶灯号,驾驶员姓名,驾驶证号,营审日期,次营审日期,年审日期,下次年审,投保日期,投保时长,车辆状态,违章次数) values('" +
                      carid_t.getText().trim() + "','" +
                      factory_t.getText().trim() + "','" +
                      actionid_t.getText().trim() + "','" +
                      under_t.getText().trim() + "','" +
                      jComboBox1.getSelectedItem() + "','" +
                      businessid_t.getText().trim() + "','" +
                      countmoney_t.getText().trim() + "','" +
                      lightid_t.getText().trim() + "','" +
                      drivername_t.getText().trim() + "','" +
                      driveid_t.getText().trim() + "','" +
                      yingdate.getText().trim() + "','" +
                      nextyingdate.getText().trim() + "','" +
                      yeardate.getText().trim() + "','" +
                      nextyeardate.getText().trim() + "','" +
                      toudate.getText().trim() + "','" +
                      protecthour_t.getText().trim() + "','" +
                      jComboBox2.getSelectedItem() + "'," +
                      breaklowcount_t.getText().trim() + "" + ")";

                if (db.updateSql(str)) {
                    JOptionPane.showMessageDialog(null, "添加车辆成功!");
                    carid_t.setText("");
                    factory_t.setText("");
                    actionid_t.setText("");
                    under_t.setText("");
                    businessid_t.setText("");
                    countmoney_t.setText("");
                    lightid_t.setText("");
                    drivername_t.setText("");
                    yeardate.setText("");
                    nextyeardate.setText("");
                    yingdate.setText("");
                    nextyingdate.setText("");
                    toudate.setText("");
                    driveid_t.setText("");
                    breaklowcount_t.setText("0");
                    protecthour_t.setText("");

                } else {
                    JOptionPane.showMessageDialog(null, "添加车辆失败!");
                }
            }
        } catch (HeadlessException ex) {
        } catch (SQLException ex) {
        }
    }

    public void jButton2_actionPerformed(ActionEvent e) {
        carid_t.setText("");
        factory_t.setText("");
        actionid_t.setText("");
        under_t.setText("");
        businessid_t.setText("");
        countmoney_t.setText("");
        lightid_t.setText("");
        drivername_t.setText("");
        yeardate.setText("");
        nextyeardate.setText("");
        yingdate.setText("");
        nextyingdate.setText("");
        toudate.setText("");
        driveid_t.setText("");
        breaklowcount_t.setText("0");
        protecthour_t.setText("");
    }

    public void jButton3_actionPerformed(ActionEvent e) {
        if(db!=null)
        db.closeConnection();
        this.dispose();

    }

//    public void breaklowcount_t_keyPressed(KeyEvent e) {
//        if (e.getKeyCode() == KeyEvent.VK_ENTER) {
//            db=new DataBaseManager();
//       String str = "select * from car where 车牌号='"+carid_t.getText() .trim()+"'" ;
//       try {
////            r = db.getResult(str);
////            r.first();
//           if (db.getResult(str).first()) {
//               JOptionPane.showMessageDialog(null, "该车辆已存在!");
//               carid_t.setText("");
//               factory_t.setText("");
//               actionid_t.setText("");
//               under_t.setText("");
//               businessid_t.setText("");
//               countmoney_t.setText("");
//               lightid_t.setText("");
//               drivername_t.setText("");
//               yeardate.setText("");
//               nextyeardate.setText("");
//               yingdate.setText("");
//               nextyingdate.setText("");
//               toudate.setText("");
//               driveid_t.setText("");
//               breaklowcount_t.setText("0");
//               protecthour_t.setText("");
//           } else {
//               str = "insert into car(车牌号,制造商,发动机号,底盘编号,燃油类型,营运证号,计价器号,顶灯号,驾驶员姓名,驾驶证号,营审日期,次营审日期,年审日期,下次年审,投保日期,投保时长,车辆状态,违章次数) values('" +
//                     carid_t.getText().trim() + "','" +
//                     factory_t.getText().trim() + "','" +
//                     actionid_t.getText().trim() + "','" +
//                     under_t.getText().trim() + "','" +
//                     jComboBox1.getSelectedItem() + "','" +
//                     businessid_t.getText().trim() + "','" +
//                     countmoney_t.getText().trim() + "','" +
//                     lightid_t.getText().trim() + "','" +
//                     drivername_t.getText().trim() + "','" +
//                     driveid_t.getText().trim() + "','" +
//                     yingdate.getText().trim() + "','" +
//                     nextyingdate.getText().trim() + "','" +
//                     yeardate.getText().trim() + "','" +
//                     nextyeardate.getText().trim() + "','" +
//                     toudate.getText().trim() + "','" +
//                     protecthour_t.getText().trim() + "','" +
//                     jComboBox2.getSelectedItem() + "'," +
//                     breaklowcount_t.getText().trim() + "" + ")";
//
//               if (db.updateSql(str)) {
//                   JOptionPane.showMessageDialog(null, "添加车辆成功!");
//                   carid_t.setText("");
//                   factory_t.setText("");
//                   actionid_t.setText("");
//                   under_t.setText("");
//                   businessid_t.setText("");
//                   countmoney_t.setText("");
//                   lightid_t.setText("");
//                   drivername_t.setText("");
//                   yeardate.setText("");
//                   nextyeardate.setText("");
//                   yingdate.setText("");
//                   nextyingdate.setText("");
//                   toudate.setText("");
//                   driveid_t.setText("");
//                   breaklowcount_t.setText("0");
//                   protecthour_t.setText("");
//
//               } else {
//                   JOptionPane.showMessageDialog(null, "添加车辆失败!");
//               }
//           }
//       } catch (HeadlessException ex) {
//       } catch (SQLException ex) {
//       }
//
//
//        }
//    }
    public void carid_t_focusLost(FocusEvent e) {

        if (carid_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "车号不能为空!");
    }

    public void factory_t_focusLost(FocusEvent e) {

        if (factory_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "制造商不能为空!");
    }

    public void actionid_t_focusLost(FocusEvent e) {

        if (actionid_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "发动机号不能为空!");
    }

    public void under_t_focusLost(FocusEvent e) {

        if (under_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "底盘号不能为空!");
    }

    public void businessid_t_focusLost(FocusEvent e) {

        if (businessid_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "营运证号不能为空!");
    }

    public void countmoney_t_focusLost(FocusEvent e) {

        if (countmoney_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "计价器号不能为空!");
    }

    public void lightid_t_focusLost(FocusEvent e) {

        if (lightid_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "顶灯号不能为空!");
    }

    public void drivername_t_focusLost(FocusEvent e) {

        if (drivername_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "驾驶员姓名不能为空!");
    }

    public void driveid_t_focusLost(FocusEvent e) {

        if (driveid_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "驾驶证号不能为空!");
    }

    public void protecthour_t_focusLost(FocusEvent e) {

        if (protecthour_t.getText().trim().equals(""))
            JOptionPane.showMessageDialog(null, "投保时长不能为空!");
    }

⌨️ 快捷键说明

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