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

📄 findcar.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 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.KeyAdapter;
import java.awt.event.KeyEvent;

public class FindCar extends JFrame {
    TableExample te = new TableExample();
    DataBaseManager db = null;
    ResultSet r;
    JPanel jPanel1 = new JPanel();
    XYLayout xYLayout1 = new XYLayout();
    Border border1 = BorderFactory.createEtchedBorder(Color.white,
            new Color(148, 145, 140));
    JPanel jPanel2 = new JPanel();
    Border border2 = BorderFactory.createEtchedBorder(Color.white,
            new Color(148, 145, 140));
    JRadioButton jRadioButton1 = new JRadioButton();
    JRadioButton jRadioButton2 = new JRadioButton();
    XYLayout xYLayout2 = new XYLayout();
    XYLayout xYLayout3 = new XYLayout();
    JLabel jLabel1 = new JLabel();
    JTextField jTextField1 = new JTextField();
    JLabel jLabel2 = new JLabel();
    JLabel jLabel3 = new JLabel();
    JTextField jTextField2 = new JTextField();
    JTextField jTextField3 = new JTextField();
    JLabel jLabel4 = new JLabel();
    JLabel jLabel5 = new JLabel();
    JTextField jTextField4 = new JTextField();
    JTextField jTextField5 = new JTextField();
    JButton jButton1 = new JButton(new ImageIcon("image\\113.gif"));
    JButton jButton2 = new JButton(new ImageIcon("image\\back.gif"));
    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(165, 163, 151));
    JScrollPane jScrollPane1 = new JScrollPane();
    JTable jTable1;
    public FindCar() {
        try {
            jbInit();
            //this.setSize(621,536);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

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

    private void jbInit() throws Exception {
        this.setTitle("沈阳志远出租汽车公司出租车信息管理系统—车辆查询窗口");

        this.getContentPane().setLayout(xYLayout1);
        jPanel1.setBorder(border1);
        jPanel1.setLayout(xYLayout2);
        xYLayout1.setWidth(678);
        xYLayout1.setHeight(540);
        jButton2.setBackground(Color.white);
        jButton2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jButton2.addActionListener(new FindCar_jButton2_actionAdapter(this));
        jLabel3.setBorder(border3);
        jLabel2.setBorder(border4);
        jLabel4.setBorder(border5);
        jLabel5.setBorder(border6);
        jRadioButton1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jRadioButton1.setSelected(true);
        jRadioButton1.addActionListener(new FindCar_jRadioButton1_actionAdapter(this));
        jRadioButton2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jRadioButton2.addActionListener(new FindCar_jRadioButton2_actionAdapter(this));
        jLabel1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jLabel1.setText("请输入车牌号:");
        jLabel2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jLabel2.setText(" 车 牌 号:");
        jLabel3.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jLabel3.setText(" 车辆状态:");
        jLabel4.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jLabel4.setText(" 制 造 商:");
        jLabel5.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jLabel5.setText(" 违章次数:");
        jTextField2.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jTextField2.setNextFocusableComponent(jTextField4);
        jTextField3.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jTextField3.setNextFocusableComponent(jTextField5);
        jTextField4.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jTextField4.setNextFocusableComponent(jTextField3);
        jTextField5.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jTextField5.addKeyListener(new KeyAdapter() {
            public void keyPressed(KeyEvent e) {
                jTextField5_keyPressed(e);
            }
        });
        jButton1.setBackground(Color.white);
        jButton1.setFont(new java.awt.Font("Dialog", Font.PLAIN, 14));
        jButton1.setToolTipText("查   找");
        jButton1.addActionListener(new FindCar_jButton1_actionAdapter(this));
        jRadioButton2.setText("精确查找");
        jRadioButton1.setText("快速查找");
        jPanel2.setBorder(border2);
        jPanel2.setLayout(xYLayout3);
        jTextField1.addKeyListener(new KeyAdapter() {
            public void keyPressed(KeyEvent e) {
                jTextField1_keyPressed(e);
            }
        });
        jPanel1.add(jRadioButton1, new XYConstraints(5, 10, -1, -1));
        jPanel1.add(jLabel1, new XYConstraints(107, 9, 99, 35));
        jPanel1.add(jTextField1, new XYConstraints(232, 9, 130, 34));

        this.getContentPane().add(jPanel2, new XYConstraints(22, 86, 508, 95));
        jPanel2.add(jTextField4, new XYConstraints(390, 4, 98, 31));
        jPanel2.add(jTextField5, new XYConstraints(390, 49, 98, 31));
        jPanel2.add(jLabel5, new XYConstraints(311, 49, -1, 31));
        jPanel2.add(jLabel4, new XYConstraints(311, 4, 80, 32));
        jPanel2.add(jTextField2, new XYConstraints(174, 4, 96, 31));
        jPanel2.add(jTextField3, new XYConstraints(174, 50, 96, 31));
        jPanel2.add(jLabel3, new XYConstraints(92, 50, 80, 32));
        jPanel2.add(jLabel2, new XYConstraints(92, 4, 80, 31));
        jPanel2.add(jRadioButton2, new XYConstraints(5, 29, 83, -1));
        this.getContentPane().add(jPanel1, new XYConstraints(22, 25, 508, 52));

        jTable1 = te.createTable();
        jTable1.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
        jScrollPane1.setFont(new java.awt.Font("宋体", Font.PLAIN, 14));
        jScrollPane1.getViewport().add(jTable1);

        this.getContentPane().add(jScrollPane1,
                                  new XYConstraints(21, 195, 508, 317));
        this.getContentPane().add(jButton2, new XYConstraints(545, 115, 103, 50));
        this.getContentPane().add(jButton1, new XYConstraints(545, 29, 103, 46));
        jTextField2.setEnabled(false);
        jTextField3.setEnabled(false);
        jTextField4.setEnabled(false);
        jTextField5.setEnabled(false);
        this.setVisible(true);
        this.setSize(670, 580);
        this.setLocation(170, 50);

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

    }

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

    public void jButton1_actionPerformed(ActionEvent e) {
        String sql = "select * from car where ";
        String str1 = "";
        String str2 = "";
        db = new DataBaseManager();
        try {
            if (jRadioButton1.isSelected()) {
                str1 = "车牌号='" + jTextField1.getText().trim() + "'";
            } else if (jRadioButton2.isSelected()) {

⌨️ 快捷键说明

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