📄 findbroke.java
字号:
} else if (jCheckBox1.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() + "'";
}
} else if (jCheckBox2.isSelected()) {
if (db.getResult("select * from update_car where 维修日期='" +
findupdatedate_t.getText().trim() + "'").first()) {
str = "维修日期='" + findupdatedate_t.getText().trim() + "'";
}
}
te.fetch(sql + str);
} catch (HeadlessException ex) {
} catch (SQLException ex) {
}
}
public void findupdatedate_t_focusLost(FocusEvent e) {
if (findupdatedate_t.getText().trim().equals(""))
JOptionPane.showMessageDialog(null, "日期不能为空!");
else {
String s = findupdatedate_t.getText().trim() + "!";
char date[] = new char[20];
int i;
date = s.toCharArray();
for (i = 0; date[i] != '!'; i++)
if ((date[i] >= '0' && date[i] <= '9') || date[i] == '.')
;
else {
JOptionPane.showMessageDialog(null,
"您输入的日期非法或您输入的日期格式不正确,请以“.”为分隔符!");
findupdatedate_t.setText("");
findupdatedate_t.setFocusable(true);
break;
}
db2 = new DataBaseManager();
try {
if (!db2.getResult("select * from car where 车牌号='" +
findcarid_t.getText().trim() + "'").first()) {
String s1 = "没有编号为" + findcarid_t.getText().trim() +
"的车辆!";
JOptionPane.showMessageDialog(null, s1);
findcarid_t.setFocusable(true);
}
} catch (HeadlessException ex) {
} catch (SQLException ex) {
}
}
}
public void findcarid_t_focusLost(FocusEvent e) {
if (findcarid_t.getText().trim().equals(""))
JOptionPane.showMessageDialog(null, "车牌号不能为空!");
else {
db2 = new DataBaseManager();
try {
if (!db2.getResult("select * from car where 车牌号='" +
findcarid_t.getText().trim() + "'").first()) {
String s = "没有编号为" + findcarid_t.getText().trim() +
"的车辆!";
JOptionPane.showMessageDialog(null, s);
findcarid_t.setFocusable(true);
}
} catch (HeadlessException ex) {
} catch (SQLException ex) {
}
}
}
public void findcarid_t_keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
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() +
"'";
}
} else if (jCheckBox1.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() + "'";
}
} else if (jCheckBox2.isSelected()) {
if (db.getResult("select * from update_car where 维修日期='" +
findupdatedate_t.getText().trim() + "'").
first()) {
str = "维修日期='" + findupdatedate_t.getText().trim() +
"'";
}
}
te.fetch(sql + str);
} catch (HeadlessException ex) {
} catch (SQLException ex) {
}
}
}
public void findupdatedate_t_keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
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() +
"'";
}
} else if (jCheckBox1.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() + "'";
}
} else if (jCheckBox2.isSelected()) {
if (db.getResult("select * from update_car where 维修日期='" +
findupdatedate_t.getText().trim() + "'").
first()) {
str = "维修日期='" + findupdatedate_t.getText().trim() +
"'";
}
}
te.fetch(sql + str);
} catch (HeadlessException ex) {
} catch (SQLException ex) {
}
}
}
}
class Findbroke_jCheckBox2_actionAdapter implements ActionListener {
private Findbroke adaptee;
Findbroke_jCheckBox2_actionAdapter(Findbroke adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jCheckBox2_actionPerformed(e);
}
}
class Findbroke_jCheckBox1_actionAdapter implements ActionListener {
private Findbroke adaptee;
Findbroke_jCheckBox1_actionAdapter(Findbroke adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jCheckBox1_actionPerformed(e);
}
}
class Findbroke_jButton2_actionAdapter implements ActionListener {
private Findbroke adaptee;
Findbroke_jButton2_actionAdapter(Findbroke adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -