?? addaction.java~9~
字號:
package informationsystem.gui;
import java.awt.event.*;
import informationsystem.gui.MainWindow;
import informationsystem.information.*;
public class AddAction
implements ActionListener {
private MainWindow window;
public AddAction(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 {
if (this.window.jTextField2.getText().length() == 0) {
this.window.jTextPane1.setText("請輸入姓名!");
// 清空信息框
return;
}
if (this.window.jTextField3.getText().length() == 0) {
this.window.jTextPane1.setText("請輸入所在學院!");
return;
}
if (this.window.jTextField4.getText().length() == 0) {
this.window.jTextPane1.setText("請輸入所在班級!");
return;
}
if (this.window.jTextField5.getText().length() == 0) {
this.window.jTextPane1.setText("請輸入學號!");
return;
}
if (Student.addStudent(this.window.jTextField5.getText(),
this.window.jTextField2.getText(),
this.window.jTextField3.getText(),
this.window.jTextField4.getText())) {
this.window.jTextPane1.setText("添加成功!");
}
else {
this.window.jTextPane1.setText("添加失敗!");
}
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -