내 프로그램에서 JOptionPane.showConfirmDialog를 사용하여 사용자가 시뮬레이션을 종료 할 것인지 묻는 메시지를 표시합니다. "아니오"를 클릭하면 prgoram은 "계속되는 siumlation ..."을 출력하고 계속 프로그램을 계속 진행하지만 아무 것도 클릭하지 않으면 "계속 시뮬레이션"이 출력되고 "유지 보수가 수행되지 않습니다" 시뮬레이션 종료 ... " 어쨌든 이것이 왜 일어나는 지 알 수 있습니까? 첫 번째 대화 상자에서 "아니오"를 클릭하면 두 번째 대화 상자를 사용하지 않았기 때문버튼을 클릭하면 왜 내 프로그램이 잘못된 출력을 내 보냅니 까?
if(main.equalsIgnoreCase("N") | main.equalsIgnoreCase("NO")){
result = JOptionPane.showConfirmDialog(null, "WARNING! Are you sure you don't want to carry out maintenance? The simulation will stop if you click YES. ", "TERMINATE THE SIMULATION? ", JOptionPane.YES_NO_OPTION);
if(JOptionPane.NO_OPTION == result){
System.out.println("Continuing Simulation...");
}
if (JOptionPane.YES_OPTION == result) {
Result2 = JOptionPane.showConfirmDialog(null, "Are you sure you want to exit the simulation?", "Are You Sure?", JOptionPane.YES_NO_OPTION);
}
if(JOptionPane.YES_OPTION == Result2){
System.out.println("Maintenance will not be carried out, exiting Simulation...");
try{
System.exit(0);
}
finally{
System.err.println("Exiting...");
System.exit(1);
}
}
if (JOptionPane.NO_OPTION == Result2) {
System.out.println("Continuing simulation...");
}
}