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 instead of just one? If not, how could i accomplish this using some type of prompt. I am creating Battleship, and wanted to prompt the user to specify locations to place each ship.

Thanks,

Tomek

Answers


The object that you pass in as the message to the JOptionPane can be graphical components, 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.
}

Need Your Help

Why are products in the category with Mage::app('default') but not with Mage::app('admin')?

magento collections count category products

I wrote an extension and in this extension I need the count of active products of a category.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.