gpt4 book ai didi

java - joptionpane 和带有是或否按钮的确认对话框

转载 作者:行者123 更新时间:2023-12-03 03:50:49 26 4
gpt4 key购买 nike

该代码正在运行。但问题是,当选择 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);

这将满足要求

关于java - joptionpane 和带有是或否按钮的确认对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12300573/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com