当前位置: 代码迷 >> J2SE >> 为啥会这样
  详细解决方案

为啥会这样

热度:155   发布时间:2016-04-24 13:39:25.0
为什么会这样?
JOptionPane.showConfirmDialog(this, "这是确认框confirm! ", "Confirm   Dlg ",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE);
我把它放在action中删除程序的最上面,用它弹出确认提示框,但不论我点是,否,还是撤销下面的代码都会被执行,即值被删除???

------解决方案--------------------
have a try
int rst = JOptionPane.showConfirmDialog(this, "这是确认框confirm! ", "Confirm Dlg ",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE);
if (rst != JOptionPane.YES_OPTION) {
return;
}
  相关解决方案