Java 类javax.security.auth.callback.ConfirmationCallback 实例源码

项目:xunxian    文件:SaoHuo.java   
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
    if (new Func.Message()
            .showConfirmDialog("设置宠物壳子所有物品的价格为2铜之内自动买进。<br/>注意:设置后原本配置的数据会都变成2铜<br/>确定要进行快速设置?") == ConfirmationCallback.YES) {
        int money = 2;
        SaoHuoFunc saoHuoFunc = new SaoHuoFunc();
        TableModel model = (TableModel) Command.JframeSaoHuo.stonejTable
                .getModel();
        for (int row = model.getRowCount() - 1; row >= 0; row--) {
            model.setValueAt(money, row, 2);
            model.setValueAt(saoHuoFunc.moneyToString(money), row, 1);

        }

        saoHuoFunc = null;
        model = null;
    }
}
项目:xunxian    文件:SaoHuo.java   
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
    if (new Func.Message()
            .showConfirmDialog("设置宠物壳子所有物品的价格为2铜之内自动买进。<br/>注意:设置后原本配置的数据会都变成2铜<br/>确定要进行快速设置?") == ConfirmationCallback.YES) {
        int money = 2;
        SaoHuoFunc saoHuoFunc = new SaoHuoFunc();
        TableModel model = (TableModel) Command.JframeSaoHuo.petjTable
                .getModel();
        for (int row = model.getRowCount() - 1; row >= 0; row--) {
            model.setValueAt(money, row, 2);
            model.setValueAt(saoHuoFunc.moneyToString(money), row, 1);

        }

        saoHuoFunc = null;
        model = null;
    }
}
项目:xunxian    文件:SaoHuo.java   
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
    if (new Func.Message()
            .showConfirmDialog("设置其他分类里面所有物品的价格为2铜之内自动买进。<br/>注意:设置后原本配置的数据会都变成2铜<br/>确定要进行快速设置?") == ConfirmationCallback.YES) {
        int money = 2;
        SaoHuoFunc saoHuoFunc = new SaoHuoFunc();
        TableModel model = (TableModel) Command.JframeSaoHuo.elseClassjTable
                .getModel();
        for (int row = model.getRowCount() - 1; row >= 0; row--) {
            model.setValueAt(money, row, 2);
            model.setValueAt(saoHuoFunc.moneyToString(money), row, 1);

        }

        saoHuoFunc = null;
        model = null;
    }
}
项目:xunxian    文件:SaoHuo.java   
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
    if (new Func.Message()
            .showConfirmDialog("设置传奇图纸所有物品的价格为2铜之内自动买进。<br/>注意:设置后原本配置的数据会都变成2铜<br/>确定要进行快速设置?") == ConfirmationCallback.YES) {
        int money = 2;
        SaoHuoFunc saoHuoFunc = new SaoHuoFunc();
        TableModel model = (TableModel) Command.JframeSaoHuo.legendjTable
                .getModel();
        for (int row = model.getRowCount() - 1; row >= 0; row--) {
            model.setValueAt(money, row, 2);
            model.setValueAt(saoHuoFunc.moneyToString(money), row, 1);

        }

        saoHuoFunc = null;
        model = null;
    }
}
项目:xunxian    文件:SaoHuo.java   
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
    if (new Func.Message()
            .showConfirmDialog("设置风物志类所有物品的价格为2铜之内自动买进。<br/>注意:设置后原本配置的数据会都变成2铜<br/>确定要进行快速设置?") == ConfirmationCallback.YES) {
        int money = 2;
        SaoHuoFunc saoHuoFunc = new SaoHuoFunc();
        TableModel model = (TableModel) Command.JframeSaoHuo.fengWuZhijTable
                .getModel();
        for (int row = model.getRowCount() - 1; row >= 0; row--) {
            model.setValueAt(money, row, 2);
            model.setValueAt(saoHuoFunc.moneyToString(money), row, 1);

        }

        saoHuoFunc = null;
        model = null;
    }
}
项目:xunxian    文件:SaoHuo.java   
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    if (new Func.Message()
            .showConfirmDialog("设置杂货类所有物品的价格为2铜之内自动买进。<br/>注意:设置后原本配置的数据会都变成2铜<br/>确定要进行快速设置?") == ConfirmationCallback.YES) {
        int money = 2;
        SaoHuoFunc saoHuoFunc = new SaoHuoFunc();
        TableModel model = (TableModel) Command.JframeSaoHuo.groceriesjTable
                .getModel();
        for (int row = model.getRowCount() - 1; row >= 0; row--) {
            model.setValueAt(money, row, 2);
            model.setValueAt(saoHuoFunc.moneyToString(money), row, 1);

        }

        saoHuoFunc = null;
        model = null;
    }
}
项目:xunxian    文件:Main.java   
private void jMenuItem15ActionPerformed(java.awt.event.ActionEvent evt) {
    if (new Func.Message()
            .showConfirmDialog("软件使用Java编写,使用了大漠、大兵、信诺模块,与游戏的交互、图、色、文字点阵等辨别都已写Java接口,<br/>可以完全使用Java来进行开发!软件源代码会象征性收费1000元<br/>随着时间价格会逐渐降低,甚至,会免费放出!敬请期待!喜欢辅助软件开发的小朋友,可以联系,<br/>当然,喜欢不劳而获的那种人,请勿打扰!<br/><br/>"
                    + "功能简介:<br/>"
                    + "1.打怪挂机点增加So Easy,录入点坐标,一行代码就可增加一个挂机点!<br/>"
                    + "2.多线程监控,打怪线程、辅助线程、日志线程、系统线程、定时监控软件正常运行<br/>"
                    + "3.底层接口丰富,大漠、信诺...等模块操作系统的接口全部用写好,可直接调用!不想做寻仙做其他的游戏也完全可以<br/>"
                    + "4.基本功能模块皆有,JAVA的松耦合完美诠释。每个模块都可单独拿出做其他游戏的辅助,就如,按键精灵!<br/>"
                    + "5.扫货的数据维护,八卦灵石、宠物壳子、可直接一行代码录入数据!这都不是事<br/>"
                    + "6.界面使用MyEclipse8.5设计,可拖拽如VB、易语言的界面设计<br/>"
                    + "7.整套自己的系统,有自己的腾讯云服务器,php软件注册系统!注册码开号实时控制<br/>"
                    + "8.内置代理接口,代理可自行开注册码<br/>"
                    + "<br/>"
                    + "废话不多说,本人QQ921153866,拒加喜欢不劳而获者,贪小便宜者,思想愚笨者<br/>"
                    + "<br/>是否查看源码文件?") == ConfirmationCallback.YES) {
        System.out.println("aaa");
    }
}
项目:xunxian    文件:Main.java   
private void SaveDatajButtonActionPerformed(java.awt.event.ActionEvent evt) {
    if (new Func.Message().showConfirmDialog("确定要保存数据?") == ConfirmationCallback.YES) {
        try {
            File file = new action.File();

            file.saoHuoGroceriesSave();
            file.saoHuoStoneSave();
            file.saoHuoPetSave();
            file.saoHuoFengWuZhiSave();
            file.saoHuoLegendSave();
            file.saoHuoElseClassSave();
            file.UISave();

            new Func.Message().showMessageDialog("保存成功");
            file = null;
        } catch (Exception e) {
            new Func.Message().showMessageDialog("执行失败");
        }
    }
}
项目:cn1    文件:ConfirmationCallbackTest.java   
/**
 * test of methods getOptionType(), getDefaultOption(), getMessageType()
 * getOptions(), set/getSelectedIndex
 */
public final void testConfirmationCallback_09() throws IllegalArgumentException {
    String[] opt = {"CONTINUE", "ABORT"};
    String[] s;

        cc = new ConfirmationCallback("prompt", mt[0], opt, 1);
        assertEquals(1, cc.getDefaultOption());
        assertEquals(ConfirmationCallback.INFORMATION, cc.getMessageType());
        assertEquals(opt,cc.getOptions());
        s = cc.getOptions();
        for (int i = 0; i < opt.length; i++){
            assertEquals(opt[i], s[i]);
        }
        assertEquals("prompt", cc.getPrompt());
        assertEquals(-1, cc.getOptionType());
        assertEquals(ConfirmationCallback.UNSPECIFIED_OPTION, cc.getOptionType());
        assertNotNull(cc.getOptions());
        cc.setSelectedIndex(1);
        assertEquals(1, cc.getSelectedIndex());
}
项目:freeVM    文件:ConfirmationCallbackTest.java   
/**
 * test of methods getOptionType(), getDefaultOption(), getMessageType()
 * getOptions(), set/getSelectedIndex
 */
public final void testConfirmationCallback_09() throws IllegalArgumentException {
    String[] opt = {"CONTINUE", "ABORT"};
    String[] s;

        cc = new ConfirmationCallback("prompt", mt[0], opt, 1);
        assertEquals(1, cc.getDefaultOption());
        assertEquals(ConfirmationCallback.INFORMATION, cc.getMessageType());
        assertEquals(opt,cc.getOptions());
        s = cc.getOptions();
        for (int i = 0; i < opt.length; i++){
            assertEquals(opt[i], s[i]);
        }
        assertEquals("prompt", cc.getPrompt());
        assertEquals(-1, cc.getOptionType());
        assertEquals(ConfirmationCallback.UNSPECIFIED_OPTION, cc.getOptionType());
        assertNotNull(cc.getOptions());
        cc.setSelectedIndex(1);
        assertEquals(1, cc.getSelectedIndex());
}
项目:freeVM    文件:ConfirmationCallbackTest.java   
/**
 * test of methods getOptionType(), getDefaultOption(), getMessageType()
 * getOptions(), set/getSelectedIndex
 */
public final void testConfirmationCallback_09() throws IllegalArgumentException {
    String[] opt = {"CONTINUE", "ABORT"};
    String[] s;

        cc = new ConfirmationCallback("prompt", mt[0], opt, 1);
        assertEquals(1, cc.getDefaultOption());
        assertEquals(ConfirmationCallback.INFORMATION, cc.getMessageType());
        assertEquals(opt,cc.getOptions());
        s = cc.getOptions();
        for (int i = 0; i < opt.length; i++){
            assertEquals(opt[i], s[i]);
        }
        assertEquals("prompt", cc.getPrompt());
        assertEquals(-1, cc.getOptionType());
        assertEquals(ConfirmationCallback.UNSPECIFIED_OPTION, cc.getOptionType());
        assertNotNull(cc.getOptions());
        cc.setSelectedIndex(1);
        assertEquals(1, cc.getSelectedIndex());
}
项目:jdk8u-jdk    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:openjdk-jdk10    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:openjdk9    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:jdk8u_jdk    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:lookaside_java-1.8.0-openjdk    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:javify    文件:AbstractCallbackHandler.java   
public void handle(Callback[] callbacks)
  throws IOException, UnsupportedCallbackException
{
  if (callbacks == null)
    throw new NullPointerException();
  for (int i = 0; i < callbacks.length; i++)
    {
      if (callbacks[i] == null)
        continue;
      if (callbacks[i] instanceof ChoiceCallback)
        handleChoice((ChoiceCallback) callbacks[i]);
      else if (callbacks[i] instanceof ConfirmationCallback)
        handleConfirmation((ConfirmationCallback) callbacks[i]);
      else if (callbacks[i] instanceof LanguageCallback)
        handleLanguage((LanguageCallback) callbacks[i]);
      else if (callbacks[i] instanceof NameCallback)
        handleName((NameCallback) callbacks[i]);
      else if (callbacks[i] instanceof PasswordCallback)
        handlePassword((PasswordCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextInputCallback)
        handleTextInput((TextInputCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextOutputCallback)
        handleTextOutput((TextOutputCallback) callbacks[i]);
      else
        handleOther(callbacks[i]);
    }
}
项目:javify    文件:AWTCallbackHandler.java   
protected synchronized void handleTextOutput(TextOutputCallback c)
{
  Frame ownerFrame = new Frame();
  Dialog dialog = new Dialog(ownerFrame);
  dialog.setLayout(new GridLayout(2, 1));
  switch (c.getMessageType() /*c.getStyle()*/)
    {
    case ConfirmationCallback.ERROR:
      dialog.setTitle(messages.getString("callback.error"));
      break;
    case ConfirmationCallback.INFORMATION:
      dialog.setTitle(messages.getString("callback.information"));
      break;
    case ConfirmationCallback.WARNING:
      dialog.setTitle(messages.getString("callback.warning"));
      break;
    default:
      dialog.setTitle("");
    }
  Label label = new Label(c.getMessage());
  Panel buttons = new Panel();
  Button ok = new Button(messages.getString("callback.ok"));
  buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
  buttons.add(ok);
  ok.addActionListener(this);
  dialog.add(label);
  dialog.add(buttons);
  dialog.pack();
  dialog.show();
  try { wait(); }
  catch (InterruptedException ie) { }
  dialog.dispose();
  ownerFrame.dispose();
}
项目:javify    文件:DefaultCallbackHandler.java   
protected void handleConfirmation(ConfirmationCallback c)
{
  if (c.getOptionType() == ConfirmationCallback.YES_NO_OPTION)
    c.setSelectedIndex(ConfirmationCallback.NO);
  else if (c.getOptionType() == ConfirmationCallback.YES_NO_CANCEL_OPTION)
    c.setSelectedIndex(ConfirmationCallback.NO);
  else if (c.getOptionType() == ConfirmationCallback.OK_CANCEL_OPTION)
    c.setSelectedIndex(ConfirmationCallback.OK);
  else
    c.setSelectedIndex(c.getDefaultOption());
}
项目:jvm-stm    文件:AbstractCallbackHandler.java   
public void handle(Callback[] callbacks)
  throws IOException, UnsupportedCallbackException
{
  if (callbacks == null)
    throw new NullPointerException();
  for (int i = 0; i < callbacks.length; i++)
    {
      if (callbacks[i] == null)
        continue;
      if (callbacks[i] instanceof ChoiceCallback)
        handleChoice((ChoiceCallback) callbacks[i]);
      else if (callbacks[i] instanceof ConfirmationCallback)
        handleConfirmation((ConfirmationCallback) callbacks[i]);
      else if (callbacks[i] instanceof LanguageCallback)
        handleLanguage((LanguageCallback) callbacks[i]);
      else if (callbacks[i] instanceof NameCallback)
        handleName((NameCallback) callbacks[i]);
      else if (callbacks[i] instanceof PasswordCallback)
        handlePassword((PasswordCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextInputCallback)
        handleTextInput((TextInputCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextOutputCallback)
        handleTextOutput((TextOutputCallback) callbacks[i]);
      else
        handleOther(callbacks[i]);
    }
}
项目:jvm-stm    文件:AWTCallbackHandler.java   
protected synchronized void handleTextOutput(TextOutputCallback c)
{
  Frame ownerFrame = new Frame();
  Dialog dialog = new Dialog(ownerFrame);
  dialog.setLayout(new GridLayout(2, 1));
  switch (c.getMessageType() /*c.getStyle()*/)
    {
    case ConfirmationCallback.ERROR:
      dialog.setTitle(messages.getString("callback.error"));
      break;
    case ConfirmationCallback.INFORMATION:
      dialog.setTitle(messages.getString("callback.information"));
      break;
    case ConfirmationCallback.WARNING:
      dialog.setTitle(messages.getString("callback.warning"));
      break;
    default:
      dialog.setTitle("");
    }
  Label label = new Label(c.getMessage());
  Panel buttons = new Panel();
  Button ok = new Button(messages.getString("callback.ok"));
  buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
  buttons.add(ok);
  ok.addActionListener(this);
  dialog.add(label);
  dialog.add(buttons);
  dialog.pack();
  dialog.show();
  try { wait(); }
  catch (InterruptedException ie) { }
  dialog.dispose();
  ownerFrame.dispose();
}
项目:jvm-stm    文件:DefaultCallbackHandler.java   
protected void handleConfirmation(ConfirmationCallback c)
{
  if (c.getOptionType() == ConfirmationCallback.YES_NO_OPTION)
    c.setSelectedIndex(ConfirmationCallback.NO);
  else if (c.getOptionType() == ConfirmationCallback.YES_NO_CANCEL_OPTION)
    c.setSelectedIndex(ConfirmationCallback.NO);
  else if (c.getOptionType() == ConfirmationCallback.OK_CANCEL_OPTION)
    c.setSelectedIndex(ConfirmationCallback.OK);
  else
    c.setSelectedIndex(c.getDefaultOption());
}
项目:xunxian    文件:Main.java   
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    if (new Func.Message()
            .showConfirmDialog("游戏已不再留恋!软件全部免费!<br/>原本只能购买才能用的自动扫货跟工作室用的高级打怪模式全自动卦机打怪,现免费发布,免费使用!<br/>免费注册码为www.xnx3.com注册便可以用!<br/>本软件使用Java编写!精通Java,对辅助有兴趣的,可联系我QQ921153866购买源码,继续开发下去!<br/><br/>【注】软件已全免费,但答题是用的第三方的答题平台,喜欢软件的仙友仍可以自行购买自动答题服务") == ConfirmationCallback.YES) {
        Command.browser.loadUrl(
                "http://www.xnx3.com/xunxian/fuzhu/shenshan_kefu.html",
                200, 200, 800, 600);
    }
    //      switch (Command.agent) {
    //      case 1: //1是自己的
    //          Object[] options = { "自动扫货购买", "打怪自动过验证码服务" };
    //          int response = JOptionPane
    //                  .showOptionDialog(
    //                          null,
    //                          "自动打怪功能、后台键盘鼠标模拟、捉宝宝打符、免费使用!\n免费注册码:www.xnx3.com\n\n自动扫货续费都是5元一个月超低价!\n自动打怪可以购买自动过验证码服务,无需人工值守",
    //                          "软件购买", JOptionPane.YES_OPTION,
    //                          JOptionPane.QUESTION_MESSAGE, null, options,
    //                          options[0]);
    //          if (response == 0) { //客服购买
    //              Command.browser
    //                      .loadUrl(
    //                              "http://www.xnx3.com/xunxian/xxautofight/20140308/82.html",
    //                              200, 200, 1024, 900);
    //          } else if (response == 1) {
    //              Command.browser
    //                      .loadUrl(
    //                              "http://www.xnx3.com/xunxian/xxautofight/20140308/83.html",
    //                              200, 200, 1024, 900);
    //          }
    //      case 2:
    //          Command.browser.loadUrl(
    //                  "http://www.xnx3.com/xunxian/fuzhu/shenshan_kefu.html",
    //                  200, 200, 420, 700);
    //      }
}
项目:xunxian    文件:SetHwnd.java   
public static void setHwnd(){
    new Func.Message().showMessageDialog("点击确定后有1秒时间将鼠标<br/>指向要进行后台卦级的游戏窗口");
    try {
        new Func.Sleep().sleep(1000);
        Command.hwnd= Command.activeDm.invoke("GetMousePointWindow").getInt();
        String title=Command.activeDm.invoke("GetWindowTitle",Command.hwnd)+"";
        if(title.indexOf("寻仙")>-1){
            if(title.indexOf(Command.title)>-1){        //再次判断获取的不能为当前辅助软件窗口
                Command.hwnd=0; //不是寻仙窗口,还原句柄
                if(new Func.Message().showConfirmDialog("失败!本次获取的为当前软件的窗口!<br/>请点击[获取目标窗口]按钮然后点了[确定]后<br/>将鼠标放到要挂机的寻仙游戏的窗口上。<br/><br/>是否要查看此操作详细说明?")==ConfirmationCallback.YES){
                    Command.browser.loadUrl("http://www.xnx3.com/xunxian/xxautofight/20130626/41.html",200,200,800,600);
                }
            }else{      //获取正确
                Command.JForm.setHwndjLabel.setText("窗口句柄:"+Command.hwnd+",窗口名:"+title);
            }
        }else{
            if(new Func.Message().showConfirmDialog("获取窗口错误,不是寻仙窗口!<br/>点击获取目标窗口后将鼠标指向寻仙游戏<br/><br/>是否要查看此操作详细说明?")==ConfirmationCallback.YES){
                System.out.println("--");
                Command.browser.loadUrl("http://www.xnx3.com/xunxian/xxautofight/20130626/41.html",200,200,800,600);
            }
            Command.hwnd=0; //不是寻仙窗口,还原句柄
            Command.JForm.setHwndjLabel.setText("请点击前面按钮获取目标窗口");
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:infobip-open-jdk-8    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:jdk8u-dev-jdk    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:jdk7-jdk    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:openjdk-source-code-learn    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:OLD-OpenJDK8    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:cn1    文件:ConfirmationCallbackTest.java   
public void assertDeserialized(Serializable golden, Serializable test) {
    assertEquals(((ConfirmationCallback) golden).getDefaultOption(),
            ((ConfirmationCallback) test).getDefaultOption());
    assertEquals(((ConfirmationCallback) golden).getPrompt(),
            ((ConfirmationCallback) test).getPrompt());
    assertEquals(((ConfirmationCallback) golden).getMessageType(),
            ((ConfirmationCallback) test).getMessageType());
    assertEquals(((ConfirmationCallback) golden).getOptionType(),
            ((ConfirmationCallback) test).getOptionType());
}
项目:cn1    文件:ConfirmationCallbackTest.java   
/**
 *  Ctor test  
 */
public final void testConfirmationCallback_01() throws IllegalArgumentException {
    try {
        for (int i = 0; i < mt.length; i++) {
            cc = new ConfirmationCallback(mt[i], ot[1], dopt[1]);
        }
    } catch (IllegalArgumentException e){}
}
项目:cn1    文件:ConfirmationCallbackTest.java   
/**
 * test of methods getOptions(), set/getSelectedIndex when options is null
 */
public final void testConfirmationCallback_10() throws IllegalArgumentException {

        cc = new ConfirmationCallback("prompt", mt[0], ot[0], dopt[0]);
        assertNull(cc.getOptions());
        cc.setSelectedIndex(1);
        assertEquals(1, cc.getSelectedIndex());
}
项目:JamVM-PH    文件:AbstractCallbackHandler.java   
public void handle(Callback[] callbacks)
  throws IOException, UnsupportedCallbackException
{
  if (callbacks == null)
    throw new NullPointerException();
  for (int i = 0; i < callbacks.length; i++)
    {
      if (callbacks[i] == null)
        continue;
      if (callbacks[i] instanceof ChoiceCallback)
        handleChoice((ChoiceCallback) callbacks[i]);
      else if (callbacks[i] instanceof ConfirmationCallback)
        handleConfirmation((ConfirmationCallback) callbacks[i]);
      else if (callbacks[i] instanceof LanguageCallback)
        handleLanguage((LanguageCallback) callbacks[i]);
      else if (callbacks[i] instanceof NameCallback)
        handleName((NameCallback) callbacks[i]);
      else if (callbacks[i] instanceof PasswordCallback)
        handlePassword((PasswordCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextInputCallback)
        handleTextInput((TextInputCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextOutputCallback)
        handleTextOutput((TextOutputCallback) callbacks[i]);
      else
        handleOther(callbacks[i]);
    }
}
项目:JamVM-PH    文件:AWTCallbackHandler.java   
protected synchronized void handleTextOutput(TextOutputCallback c)
{
  Frame ownerFrame = new Frame();
  Dialog dialog = new Dialog(ownerFrame);
  dialog.setLayout(new GridLayout(2, 1));
  switch (c.getMessageType() /*c.getStyle()*/)
    {
    case ConfirmationCallback.ERROR:
      dialog.setTitle(messages.getString("callback.error"));
      break;
    case ConfirmationCallback.INFORMATION:
      dialog.setTitle(messages.getString("callback.information"));
      break;
    case ConfirmationCallback.WARNING:
      dialog.setTitle(messages.getString("callback.warning"));
      break;
    default:
      dialog.setTitle("");
    }
  Label label = new Label(c.getMessage());
  Panel buttons = new Panel();
  Button ok = new Button(messages.getString("callback.ok"));
  buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
  buttons.add(ok);
  ok.addActionListener(this);
  dialog.add(label);
  dialog.add(buttons);
  dialog.pack();
  dialog.show();
  try { wait(); }
  catch (InterruptedException ie) { }
  dialog.dispose();
  ownerFrame.dispose();
}
项目:JamVM-PH    文件:DefaultCallbackHandler.java   
protected void handleConfirmation(ConfirmationCallback c)
{
  if (c.getOptionType() == ConfirmationCallback.YES_NO_OPTION)
    c.setSelectedIndex(ConfirmationCallback.NO);
  else if (c.getOptionType() == ConfirmationCallback.YES_NO_CANCEL_OPTION)
    c.setSelectedIndex(ConfirmationCallback.NO);
  else if (c.getOptionType() == ConfirmationCallback.OK_CANCEL_OPTION)
    c.setSelectedIndex(ConfirmationCallback.OK);
  else
    c.setSelectedIndex(c.getDefaultOption());
}
项目:JAVA_UNIT    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:openjdk-jdk7u-jdk    文件:Confirm.java   
public static void main(String[] args) throws Exception {
    // Provide answer in an individual stream so that the program
    // does not block.
    System.setIn(new ByteArrayInputStream("1\n".getBytes()));

    new TextCallbackHandler().handle(new Callback[]{
        new ConfirmationCallback("Prince", ConfirmationCallback.INFORMATION,
                new String[]{"To be", "Not to be"}, 0)});
}
项目:classpath    文件:AbstractCallbackHandler.java   
public void handle(Callback[] callbacks)
  throws IOException, UnsupportedCallbackException
{
  if (callbacks == null)
    throw new NullPointerException();
  for (int i = 0; i < callbacks.length; i++)
    {
      if (callbacks[i] == null)
        continue;
      if (callbacks[i] instanceof ChoiceCallback)
        handleChoice((ChoiceCallback) callbacks[i]);
      else if (callbacks[i] instanceof ConfirmationCallback)
        handleConfirmation((ConfirmationCallback) callbacks[i]);
      else if (callbacks[i] instanceof LanguageCallback)
        handleLanguage((LanguageCallback) callbacks[i]);
      else if (callbacks[i] instanceof NameCallback)
        handleName((NameCallback) callbacks[i]);
      else if (callbacks[i] instanceof PasswordCallback)
        handlePassword((PasswordCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextInputCallback)
        handleTextInput((TextInputCallback) callbacks[i]);
      else if (callbacks[i] instanceof TextOutputCallback)
        handleTextOutput((TextOutputCallback) callbacks[i]);
      else
        handleOther(callbacks[i]);
    }
}
项目:classpath    文件:AWTCallbackHandler.java   
protected synchronized void handleTextOutput(TextOutputCallback c)
{
  Frame ownerFrame = new Frame();
  Dialog dialog = new Dialog(ownerFrame);
  dialog.setLayout(new GridLayout(2, 1));
  switch (c.getMessageType() /*c.getStyle()*/)
    {
    case ConfirmationCallback.ERROR:
      dialog.setTitle(messages.getString("callback.error"));
      break;
    case ConfirmationCallback.INFORMATION:
      dialog.setTitle(messages.getString("callback.information"));
      break;
    case ConfirmationCallback.WARNING:
      dialog.setTitle(messages.getString("callback.warning"));
      break;
    default:
      dialog.setTitle("");
    }
  Label label = new Label(c.getMessage());
  Panel buttons = new Panel();
  Button ok = new Button(messages.getString("callback.ok"));
  buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
  buttons.add(ok);
  ok.addActionListener(this);
  dialog.add(label);
  dialog.add(buttons);
  dialog.pack();
  dialog.show();
  try { wait(); }
  catch (InterruptedException ie) { }
  dialog.dispose();
  ownerFrame.dispose();
}
项目:classpath    文件:DefaultCallbackHandler.java   
protected void handleConfirmation(ConfirmationCallback c)
{
  if (c.getOptionType() == ConfirmationCallback.YES_NO_OPTION)
    c.setSelectedIndex(ConfirmationCallback.NO);
  else if (c.getOptionType() == ConfirmationCallback.YES_NO_CANCEL_OPTION)
    c.setSelectedIndex(ConfirmationCallback.NO);
  else if (c.getOptionType() == ConfirmationCallback.OK_CANCEL_OPTION)
    c.setSelectedIndex(ConfirmationCallback.OK);
  else
    c.setSelectedIndex(c.getDefaultOption());
}