import com.sun.security.auth.callback.DialogCallbackHandler;
import javax.security.auth.callback.*;
public class Default {
public static void main(String args[]) throws Exception {
DialogCallbackHandler h = new DialogCallbackHandler();
TextOutputCallback toc = new TextOutputCallback
(TextOutputCallback.INFORMATION,
"hello");
TextOutputCallback toc2 = new TextOutputCallback
(TextOutputCallback.INFORMATION,
"world");
ConfirmationCallback cc = new ConfirmationCallback
("Correct?",
ConfirmationCallback.INFORMATION,
ConfirmationCallback.YES_NO_OPTION,
ConfirmationCallback.NO);
Callback[] callbacks = { toc, toc2, cc };
h.handle(callbacks);
if (cc.getSelectedIndex() == ConfirmationCallback.YES) {
System.out.println("yes");
} else {
System.out.println("no");