samples/trycatchredo/src/org/apidesign/exceptions/trycatchredo/api/UserQuestionException.java
Updating to NBMs from NetBeans 8.0.1 as some of them are required to run on JDK8
1 package org.apidesign.exceptions.trycatchredo.api;
3 import java.io.IOException;
4 import javax.swing.JOptionPane;
6 // BEGIN: trycatchredo.UserQuestionException
7 /** Specialized I/O exception to request some kind of user confirmation.
8 * A code that needs to ask user shall not attempt to open a dialog itself,
9 * rather it shall emit this exception and let its callers show the dialog
10 * at appropriate time.
12 * @author Jaroslav Tulach
15 public abstract class UserQuestionException extends IOException {
16 /** Description of the dialog to show to the user. Whoever catches
17 * this exception shall use
18 * {@link #getQuestionPane()}.
19 * {@link JOptionPane#createDialog(java.lang.String)}
20 * to construct and display the dialog.
22 * @return the pane to display to user
24 public abstract JOptionPane getQuestionPane();
25 /** When the user confirms (or rejects) message presented by the
26 * {@link #getQuestionPane()} dialog, the exception shall be notified
27 * by calling this method with {@link JOptionPane#getValue()} option.
29 * @param option the option selected by the user
31 public abstract void confirm(Object option);
33 // END: trycatchredo.UserQuestionException