[英]joptionpane and confirmation dialog with yes no buttons
这段代码正在运行。 但是问题是当选择NO_OPTION时,将放置窗口。 当选择NO_OPTION时,我想保留窗口吗? 你能提出任何建议吗?
int dialogButton = JOptionPane.YES_NO_OPTION;
JOptionPane.showConfirmDialog (null, "First Row Will Selected As Default!! Do You Want To Close?","Warning",dialogButton);
if(dialogButton == JOptionPane.YES_OPTION){
int row = table.getSelectedRow();
int col = table.getSelectedColumn();
finalOID=(String)table.getModel().getValueAt(row, col);
System.out.println("cancel clicked first oid:"+finalOID);
dispose();
}
int dialogButton = JOptionPane.showConfirmDialog (null, "First Row Will Selected As Default!! Do You Want To Close?","Warning",JOptionPane.YES_NO_OPTION);
这将满足要求
您可能需要JOptionPane.YES_NO_CANCEL_OPTION
,如如何制作对话框中所述 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.