Is there a multiple input JOptionPane in Java?

I was wondering if there is a JOptionPane where you can get multiple inputs from a user, not just one? If not, how can I do this using some type of hint. I am creating an "Armadillo" and I want to offer the user to specify the location for each ship.

Thanks,

Tomek

+3
source share
1 answer

The object you pass as a JOptionPane message may be a graphical component, so something like this should work:

JPanel panel = new JPanel(); // Populate your panel components here. int ret = JOptionPane.showConfirmDialog(parent, panel, "Title", JOptionPane.YES_NO_OPTION); if ( ret == JOptionPane.YES_OPTION ) { // Read component values. } 
+11
source

All Articles