Hi,
How can I have a JOptionPane that has multiple fields for entering text. Does anyone know if this is possible, if so could you please give me an example of how to do this?

Thanks

Does it have to be a JOptionPane? JOptionPane's are usually supposed to be used to display messages, not get them, I think. They can also display a list of choices and get the user's choice. Here's the Sun tutorial for JOptionPane: http://www.j2ee.me/docs/books/tutorial/uiswing/components/dialog.html

If you're open to using different types of GUIs I can help you make a custom GUI that has multiple text fields where the user can enter text. Or, if you have to use JOptionPane, you'll have to wait and see if this is possible - maybe someone else here knows how to do it. Let me know.

I just did a quick google search on your problem and I found the following information that seems like what you're looking for:

"The trick is to pass an array of message that contains both the message and the input components in the call to JOptionPane.showOptionDialog."

No, it doesn't necessarily have to be a JOptionPane, but that was the easiest way when I was only taking one input text field, because of the showInputDialog option. I did see that suggestion about using an array for message, but I couldn't figure out how to get it to work. Could you give me an example of what they mean

EDIT: nm, I figured it out. thanks

Good. Please set this thread as Solved and best of luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.