public void actionPerformed(final ActionEvent e) {
diZhiF.setText("");
bianMaF.setText("");
chuanZhenF.setText("");
jianChengF.setText("");
lianXiRenF.setText("");
lianXiRenDianHuaF.setText("");
EMailF.setText("");
quanChengF.setText("");
dianHuaF.setText("");
yinHangF.setText("");
}
}
(3)创建TjActionListener类,该类是“添加”按钮的事件监听器,它必须实现ActionListener接口,并在actionPerformed()方法中实现用户输入的验证和供应商的保存,关键代码如下。
class TjActionListener implements ActionListener {// 添加按钮的事件监听类
public void actionPerformed(final ActionEvent e) {
if (diZhiF.getText().equals("") || quanChengF.getText().equals("")
|| chuanZhenF.getText().equals("")
|| jianChengF.getText().equals("")
|| yinHangF.getText().equals("")
|| bianMaF.getText().equals("")
|| diZhiF.getText().equals("")
|| lianXiRenF.getText().equals("")
|| lianXiRenDianHuaF.getText().equals("")
|| EMailF.getText().equals("")
|| dianHuaF.getText().equals("")) {
JOptionPane.showMessageDialog(GysTianJiaPanel.this, "请填写全部信息");
return;
}
try {
ResultSet haveUser = Dao
.query("select * from tb_gysinfo where name='"
+ quanChengF.getText().trim() + "'");
if (haveUser.next()) {
JOptionPane.showMessageDialog(GysTianJiaPanel.this, JAVA进销存管理系统的研究与应用+ER图(12):http://www.751com.cn/jisuanji/lunwen_2885.html