当用户想要删除项目或关闭窗口时,我会显示 MessageDialog。当我按如下方式显示对话框时:
else if (e.getSource() == delete_btn)
{
int result = JOptionPane.showConfirmDialog(AgentFrame.this,
"Are you sure you want to delete Agent: " + availableAgents_list.getSelectedValue().toString() +
" ?", null, JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION)
{
availableAgents_list.removeSelectionInterval(availableAgents_list.getSelectedIndex(),
availableAgents_list.getSelectedIndex());
}
}
当用户按下 YES 或 CANCEL 时,窗口会显示......我需要返回窗口执行一些操作。