请问在InputDialog中能不能有两个输入框呢?应该怎么写?
谢谢!
很急,在线等!

解决方案 »

  1.   

    看起来不行,自己继承一个JDialog去实现吧.
      

  2.   

    you can design a panel your, and add this panel into the inputdialog.for exmaple, 
    JPanel panel = new JPanel();
    JOptionPane.showConfirmDialog(thisPanel,panel,"Reference & Related File Editor",JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE);
      

  3.   

    JTextField tf1 = new JTextField(10);
    JTextField tf2 = new JTextField(10);
    JPanel p = new JPanel(new GridLayout(0, 1, 0, 5));
    p.add(new JLabel("请输入数值:", JLabel.LEFT));
    p.add(tf1);
    p.add(tf2);int r = JOptionPane.showConfirmDialog(null, p, "Input", 
    JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    if (r == JOptionPane.OK_OPTION) {
    String value1 = tf1.getText();
    String value2 = tf2.getText();
    System.out.println(value1 + " " + value2);
    }
    else {
    System.exit(0);
    }
      

  4.   

    可以参考java安装目录下的demo下的swing下的例子