code: public static CloseCallback confirming(String question)
      {
          return new CloseCallback()
          {
              @Override
              public boolean mayClose(Component componentInTab)
              {
                  int option = JOptionPane.showConfirmDialog(
                      componentInTab, question, 
                      "Confirm", JOptionPane.YES_NO_OPTION);
                  return option == JOptionPane.YES_OPTION;
              }
          };
      }
docs: Returns a {@link CloseCallback} that shows a confirmation dialog that
  asks the given question
  
  @param question The question
  @return The {@link CloseCallback}