How to have a new line text in JOptionPane

I have a String object (StringBuffer.toString) that I am displaying on a JoptionPane. But my '\n's in it are not splitting the Strings to be on different lines. Is there anything else I need to do?
[213 byte] By [etog08a] at [2007-10-3 3:10:33]
# 1
The message text should be split up automatically. How are you creating the JOptionPane?
uncle_alicea at 2007-7-14 21:01:20 > top of Java-index,Desktop,Core GUI APIs...
# 2

Object[] options = { "OK"};

JPanel messagePanel = new JPanel();

messagePanel.setAlignmentX(0);

messagePanel.setLayout(new GridLayout(2, 1));

messagePanel.add(new JLabel(warningMsg.toString()));

JPanel checkBoxPanel = new JPanel();

JLabel waLabel = new JLabel("Don't tell me again");

waLabel.setForeground(new Color(30, 30, 70));

checkBoxPanel.add(waLabel);

JCheckBox cbox = new JCheckBox();

checkBoxPanel.add(cbox);

messagePanel.add(checkBoxPanel);

int response = JOptionPane.showOptionDialog(null, messagePanel,

"Warning", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,

null, options, options[0]);

etog08a at 2007-7-14 21:01:20 > top of Java-index,Desktop,Core GUI APIs...
# 3
1) Use the "Code" formatting tags when posting code so the code is readable.2) Read the [url http://java.sun.com/developer/JDCTechTips/]Beyond the Basics of JOptionPane[/url] for a solution.
camickra at 2007-7-14 21:01:20 > top of Java-index,Desktop,Core GUI APIs...
# 4
If you pass the message to JOptionPane as a string, it will break the string up into logical lines, creating a JLabel for each line. If you pass the message in any other form, you will have to break it up yourself.
uncle_alicea at 2007-7-14 21:01:20 > top of Java-index,Desktop,Core GUI APIs...
# 5

> If you pass the message to JOptionPane as a string, it will break the string up into logical lines,

Not in my experience, hence the link I provided above which shows how you can force the text to wrap at a certain width.

Maybe you can post your working code if you have a shorter way.

camickra at 2007-7-14 21:01:20 > top of Java-index,Desktop,Core GUI APIs...
# 6
Ok thanks so much to you both. I split up the text and it was fine. But in future, I'd rather not, so I'm going on to camickr's link as I speak.. Thanks again to you both for your help.
etog08a at 2007-7-14 21:01:20 > top of Java-index,Desktop,Core GUI APIs...
# 7
I'm not talking about word-wrapping, just breaking the message at embedded linefeeds. But I didn't know about the MaxCharactersEtc. thing, so thanks for the pointer.
uncle_alicea at 2007-7-14 21:01:20 > top of Java-index,Desktop,Core GUI APIs...