[英]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.