有一个Inputdialog 它的两个按钮中第一个我设定为保存了,第二个我想把它设计成取消,应该怎么编码呢 我目前写道这样了:
int result = JOptionPane.showOptionDialog(this, bookPane, "添加书籍",
JOptionPane.NO_OPTION, JOptionPane.PLAIN_MESSAGE, null,
new String[] { "保存", "取消" }, null);
// Judge which button is clicked and perform the corresponding
// action
if (result == 0) {
bookList.save();
bookList.modified(book);
}
else{
//How to code?
}