?? deleteaction.java~11~
字號(hào):
package informationsystem.gui;
import java.awt.event.*;
import informationsystem.gui.MainWindow;
import informationsystem.database.DBHandler;
import informationsystem.information.*;
public class DeleteAction
implements ActionListener {
public DeleteAction() {
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
private MainWindow window;
private DBHandler db = new DBHandler();
public DeleteAction(MainWindow window) {
this.window = window;
}
/**
* Invoked when an action occurs.
*
* @param e ActionEvent
* @todo Implement this java.awt.event.ActionListener method
*/
public void actionPerformed(ActionEvent e) {
try {
String number = this.window.jTextField1.getText();
if (number.equals("")) {
this.window.jTextPane1.setText("請(qǐng)輸入價(jià)格!");
return;
}
if (!db.validate(number)) { // 判斷數(shù)據(jù)庫(kù)中是否有要?jiǎng)h除的記錄,如沒有則顯示提示框
this.window.jTextField1.setText("");
this.window.jTextPane1.setText("數(shù)據(jù)庫(kù)中沒有您要?jiǎng)h除的價(jià)格!");
}
else {
if (HardDisk.deleteStudent(number)) {
this.window.jTextField1.setText("");
this.window.jTextField2.setText("");
this.window.jTextField3.setText("");
this.window.jTextField4.setText("");
this.window.jTextField5.setText("");
this.window.jTextPane1.setText("記錄已成功刪除!");
}
else {
this.window.jTextPane1.setText("記錄刪除失敗!");
}
}
}
catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -