btnNewButton.addActionListener(new ActionListener() {
public void actionperformed(ActionEvent e) {
String bookName = textField.getText();
String author = textField_1.getText();
String publish = textField_2.getText();
String priceStr = textField_4.getText();
String numberStr = textField_3.getText();
String remark = textField_6.getText();
if (toolUtil) {
JOptionPane.showMessageDialog(null, "请输入相关内容");
return;
} else if (toolUtil.isEmpty(author) || toolUtil.isEmpty(publish) || toolUtil.isEmpty(priceStr) || toolUtil.isEmpty(numberStr) || toolUtil.isEmpty(remark)) {
JOptionPane.showMessageDialog(null, "请输入相关内容");
return;
}
Book_Type selectedItem = (Book_Type) comboBox.getSelectedItem();
Integer typeId = selectedItem.getTypeId();
int number;
double price;
try {
number = Integer.parseInt(numberStr);
price = new BigDecimal(priceStr).setScale(2, BigDecimal.ROUND_DOWN)
.doubleValue();
} catch (Exception e1) {
JOptionPane.showMessageDialog(null, "参数错误");
return;
}
Book book = new Book();
book.setBookName(bookName);
book.setAuthor(author);
book.setBookTypeId(typeId);
book.setNumber(number);
book.setPrice(price);
book.setPublish(publish);
book.setRemark(remark);
book.setStatus(1);
Connection con = null;
try {
con = doUtil.getConnection();
int i = bookDao.add(con, book);
if (i == 1) {
JOptionPane.showMessageDialog(null, "添加成功");
reset();
} else {
JOptionPane.showMessageDialog(null, "添加失败");
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
JOptionPane.showMessageDialog(null, "添加异常");
}
}
});
报错是这种java: <匿名cn.itcast.bookmanager.JFname.AdminBookAdd$1>不是抽象的, 并且未覆盖java.awt.event.ActionListener中的抽象方法actionPerformed(java.awt.event.ActionEvent)