Java源码示例:com.sun.security.auth.callback.DialogCallbackHandler

示例1
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");
     }

     System.exit(0);
}
 
示例2
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");
     }

     System.exit(0);
}
 
示例3
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");
     }

     System.exit(0);
}
 
示例4
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");
     }

     System.exit(0);
}
 
示例5
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");
     }

     System.exit(0);
}
 
示例6
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");
     }

     System.exit(0);
}
 
示例7
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");
     }

     System.exit(0);
}
 
示例8
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");
     }

     System.exit(0);
}
 
示例9
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");
     }

     System.exit(0);
}
 
示例10
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");
     }

     System.exit(0);
}
 
示例11
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");
     }

     System.exit(0);
}
 
示例12
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");
     }

     System.exit(0);
}