JOptionPane.showInputDialog(
                null,
                DmsMessages.getString("message.selectBU2"),
                DmsMessages.getString("label.title.selectBU2"),
                JOptionPane.PLAIN_MESSAGE, 
                null,
                possibilities, 
                possibilities[0]);在这个InputDialog中,点击确定后,会在弹出一个MessageBox
JOptionPane.showConfirmDialog(
                null,
                DmsMessages.getString("message.confirm.user.Regenerate"),
                DmsMessages.getString("Confirm.Title"),
                JOptionPane.OK_CANCEL_OPTION,
                JOptionPane.QUESTION_MESSAGE);
现在想要的效果是在后面这个ConfirmDialog弹出时,按下OK按钮,画面正常提交,两个Dialog关闭,而取消按钮按下时,ConfirmDialog画面关闭,InputDialog画面保留。
求指点。

解决方案 »

  1.   

    JOptionPane.showConfirmDialog不是有返回值吗。
    返回值==JOptionPane.OK_OPTION就是点击ok。
    返回值==JOptionPane.CANCEL_OPTION就是点击了cancel
    接下来在这里面做自己的逻辑
      

  2.   

    不是返回值的问题
    是InputDialog画面OK按下之后,我想让这个画面不关闭,在显示ConfirmDialog画面
      

  3.   

    点击完ok按钮后不想让InputDialog关闭那你写个自己的MyJOptionPane继承JOptionPane重写下showInputDialog的方法在JOptionPane的showInputDialog的源码中    public static Object showInputDialog(Component parentComponent,
            Object message, String title, int messageType, Icon icon,
            Object[] selectionValues, Object initialSelectionValue) 
            throws HeadlessException {
            JOptionPane    pane = new JOptionPane(message, messageType,
                                                  OK_CANCEL_OPTION, icon,
                                                  null, null);        pane.setWantsInput(true);
            pane.setSelectionValues(selectionValues);
            pane.setInitialSelectionValue(initialSelectionValue);
            pane.setComponentOrientation(((parentComponent == null) ?
        getRootFrame() : parentComponent).getComponentOrientation());        int style = styleFromMessageType(messageType);
            JDialog dialog = pane.createDialog(parentComponent, title, style);        pane.selectInitialValue();
            dialog.show();
            dialog.dispose();//这里是源码的关闭,你要这个去掉或者改成你自己要的逻辑        Object value = pane.getInputValue();        if (value == UNINITIALIZED_VALUE) {
                return null;
            }
            return value;
        }
      

  4.   

    能给我发下JOptionPane类的源代码庅。。
     或者说应该在什么地方能看到这个类的源代码