Java: Multiple lines of text using JOptionPane.showInputDialog(null, "Text");

jjd712 picture jjd712 · Aug 25, 2012 · Viewed 41.8k times · Source

I need a text pop up like the one you get with JOptionPane.showInputDialog(null, "Text"); Just with multiple lines, like...

I'm new to java.
I have no background in programming.
I could use some help

How would I do this?

Answer

David Kroukamp picture David Kroukamp · Aug 25, 2012

You could use '\n' like so:

JOptionPane.showMessageDialog(null, "Hello\nworld");