Пример #1
0
 public void exit() {
   // user is attempting to exit the interpreter.
   // make sure this is what they want to do
   // and check if changes need to be saved.
   int r =
       JOptionPane.showConfirmDialog(
           this,
           new JLabel("Exit Interpreter?"),
           "Confirm Exit",
           JOptionPane.YES_NO_OPTION,
           JOptionPane.QUESTION_MESSAGE);
   if (r == JOptionPane.YES_OPTION) {
     // user still wants to go ahead.
     // if file not saved then prompt to check
     // whether it should be.
     if (!dirty || checkForSave()) {
       System.exit(0);
     }
   }
 }