-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCar_Verify_Frame.java
66 lines (53 loc) · 1.87 KB
/
Car_Verify_Frame.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import java.awt.event.ActionEvent;
import java.sql.ResultSet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
class Car_Verify_Frame extends Basic_Frame {
JFrame jf_vc=new JFrame();
JPanel vc=new JPanel();
JLabel pro_submit_number_plate=new JLabel("汽车号牌",JLabel.CENTER);
JTextField text_submit_number_plate=new JTextField(20);
JLabel pro_submit_car_iden_id=new JLabel("车辆识别号",JLabel.CENTER);
JTextField text_submit_car_iden_id=new JTextField(20);
JButton submit_car_verify=new JButton("提交");
int mode;
Car_Verify_Frame() {
this.create_jf_jp(jf_vc,vc,400,400,"汽车登录");
this.JLabel_add(pro_submit_number_plate,vc,0,50,125,50);
this.JTextField_add(text_submit_number_plate,vc,125,50,225,50);
this.JLabel_add(pro_submit_car_iden_id,vc,0,150,125,50);
this.JTextField_add(text_submit_car_iden_id,vc,125,150,225,50);
this.JButton_add(submit_car_verify,vc,150,250,100,50);
}
Car_Verify_Frame(int mode) {
this();
this.mode=mode;
}
public void actionPerformed(ActionEvent e) {
try {
if (e.getSource()==submit_car_verify) {
String number_plate=text_submit_number_plate.getText();
String car_iden_id=text_submit_car_iden_id.getText();
ResultSet rs=Driving_System_MySQL.execQuery("select * from CAR where number_plate='"+number_plate+"' and car_iden_id='"+car_iden_id+"'");
if (rs.next()) {
if (mode==4) { //car_condition
jf_vc.dispose();
Car_Condition_Frame ccf=new Car_Condition_Frame(rs.getInt(21));
}
else {
jf_vc.dispose();
Car_Frame cf=new Car_Frame(mode, rs.getInt(21));
}
} else {
JOptionPane.showMessageDialog(null, "提交失败", "信息", JOptionPane.CLOSED_OPTION);
}
}
} catch(Exception e1) {
System.out.println(e1.getMessage());
}
}
}