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

📄 findbroke.java

📁 出租车管理系统,为本人毕业设计. 还请大家多多指教了
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package car;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
import javax.swing.*;
import java.awt.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.awt.Font;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class Findbroke extends JFrame {
    public Findbroke() {
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

//    public static void main(String[] args) {
//        Findbroke findbroke = new Findbroke();
//    }

    private void jbInit() throws Exception {
        this.getContentPane().setLayout(xYLayout1);
        jPanel1.setLayout(xYLayout2);
        jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jLabel1.setText("请输入车牌号:");
        jCheckBox1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jCheckBox1.setText("按车牌号查找");
        jCheckBox1.addActionListener(new Findbroke_jCheckBox1_actionAdapter(this));
        jPanel2.setBorder(BorderFactory.createEtchedBorder());
        jPanel2.setLayout(xYLayout3);
        jLabel2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jLabel2.setText("请输入维修日期:");
        findupdatedate_t.setText("");
        findupdatedate_t.addKeyListener(new KeyAdapter() {
            public void keyPressed(KeyEvent e) {
                findupdatedate_t_keyPressed(e);
            }
        });
        findupdatedate_t.addFocusListener(new FocusAdapter() {
            public void focusLost(FocusEvent e) {
                findupdatedate_t_focusLost(e);
            }
        });
        jCheckBox2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jCheckBox2.setText("按维修日期查找");
        jCheckBox2.addActionListener(new Findbroke_jCheckBox2_actionAdapter(this));
        jButton1.setBackground(Color.white);
        jButton1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jButton1.setToolTipText("查  找");
        jButton1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                jButton1_actionPerformed(e);
            }
        });
        jButton2.setBackground(Color.white);
        jButton2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jButton2.addActionListener(new Findbroke_jButton2_actionAdapter(this));
        xYLayout1.setWidth(645);
        xYLayout1.setHeight(542);
        this.setTitle("沈阳志远出租汽车公司出租车信息管理系统--查看维修信息窗口");
        findcarid_t.addFocusListener(new FocusAdapter() {
            public void focusLost(FocusEvent e) {
                findcarid_t_focusLost(e);
            }
        });
        findcarid_t.addKeyListener(new KeyAdapter() {
            public void keyPressed(KeyEvent e) {
                findcarid_t_keyPressed(e);
            }
        });
        //  jTable1.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
        jPanel1.add(jCheckBox1, new XYConstraints(5, 7, -1, -1));
        jPanel1.add(jLabel1, new XYConstraints(203, 10, -1, -1));
        jPanel1.add(findcarid_t, new XYConstraints(314, 6, 134, 31));
        jPanel2.add(jCheckBox2, new XYConstraints(6, 8, -1, -1));
        jPanel2.add(jLabel2, new XYConstraints(202, 12, -1, -1));
        jPanel2.add(findupdatedate_t, new XYConstraints(314, 4, 134, 31));
        this.getContentPane().add(jPanel2, new XYConstraints(17, 68, 488, 45));
        jTable1 = te.createTable();
        jScrollPane1.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
        this.getContentPane().add(jPanel1, new XYConstraints(17, 15, 488, 48));
        this.getContentPane().add(jButton2, new XYConstraints(524, 71, 99, 43));
        this.getContentPane().add(jButton1, new XYConstraints(524, 17, 99, 40));
        this.getContentPane().add(jScrollPane1,
                                  new XYConstraints(6, 125, 489, 387));
        jScrollPane1.getViewport().add(jTable1);
        jPanel1.setBorder(border6);
        this.setVisible(true);
        this.setSize(640, 571);
        this.setLocation(170, 50);

        addWindowListener(new WindowAdapter() {
            public void WindowClosing(WindowEvent e) {
                if (db != null)
                    db.closeConnection();
                if (db2 != null)
                    db2.closeConnection();
                dispose();
            }
        });

    }

    DataBaseManager db = null;
    DataBaseManager db2 = null;
    ResultSet r;
    TableExample te = new TableExample();
    JPanel jPanel1 = new JPanel();
    XYLayout xYLayout1 = new XYLayout();
    Border border1 = BorderFactory.createEtchedBorder(Color.white,
            new Color(165, 163, 151));
    XYLayout xYLayout2 = new XYLayout();
    JLabel jLabel1 = new JLabel();
    JTextField findcarid_t = new JTextField();
    JCheckBox jCheckBox1 = new JCheckBox();
    JPanel jPanel2 = new JPanel();
    JLabel jLabel2 = new JLabel();
    JTextField findupdatedate_t = new JTextField();
    JCheckBox jCheckBox2 = new JCheckBox();
    XYLayout xYLayout3 = new XYLayout();
    JButton jButton1 = new JButton(new ImageIcon("image\\113.gif"));
    JButton jButton2 = new JButton(new ImageIcon("image\\back.gif"));
    Border border2 = BorderFactory.createEtchedBorder(EtchedBorder.RAISED,
            Color.white, new Color(178, 178, 178));
    JTable jTable1;
    JScrollPane jScrollPane1 = new JScrollPane();
    Border border3 = BorderFactory.createEtchedBorder(Color.white,
            new Color(165, 163, 151));
    Border border4 = BorderFactory.createEtchedBorder(Color.white,
            new Color(165, 163, 151));
    Border border5 = BorderFactory.createEtchedBorder(Color.white,
            new Color(165, 163, 151));
    Border border6 = BorderFactory.createEtchedBorder(Color.white,
            new Color(148, 145, 140));

    public void jButton2_actionPerformed(ActionEvent e) {
        if (db != null)
            db.closeConnection();
        if (db2 != null)
            db2.closeConnection();
        dispose();
    }

    public void jCheckBox1_actionPerformed(ActionEvent e) {
        if (jCheckBox1.isSelected()) {
            jButton1.setEnabled(true);
            findcarid_t.setEnabled(true);
        } else {
            jButton1.setEnabled(false);
            findcarid_t.setEnabled(false);
        }
    }

    public void jCheckBox2_actionPerformed(ActionEvent e) {
        if (jCheckBox2.isSelected()) {
            jButton2.setEnabled(true);
            findupdatedate_t.setEnabled(true);
        } else {
            jButton2.setEnabled(false);
            findupdatedate_t.setEnabled(false);
        }

    }

    public void jButton1_actionPerformed(ActionEvent e) {
        String sql = "select * from update_car where ";
        String str = "";
        db = new DataBaseManager();
        try {
            if (jCheckBox1.isSelected() && jCheckBox2.isSelected()) {
                if (!db.getResult("select * from update_car where 车牌号='" +
                                  findcarid_t.getText().trim() + "'").first()) {
                    String s = "没有编号为" + findcarid_t.getText().trim() +
                               "车辆的维修记录,请重新输入车牌号。";
                    JOptionPane.showMessageDialog(null, s);
                    findcarid_t.setText("");
                } else {
                    str = "维修车号='" + findcarid_t.getText().trim() +
                          "' and 维修日期='" + findupdatedate_t.getText().trim() +
                          "'";
                }

⌨️ 快捷键说明

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