How can I create a JOptionPane that will return two input values?

Sandip Chitale

This might not exactly "return" two values but may be used to get two values from the user

JPanel p = new JPanel(new GridLayout(0,1));
JTextField tf1 = new JTextField();

JTextField tf2 = new JTextField();

if (JOptionPane.showConfirmDialog(null // may want to pass your application frame here
                           ,"Input two values"
                            ) == JOptionPane.OK_OPTION) {
  // use the tf1.getText()
  // use the tf2.getText()

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact