You may want to check BasicOptionPaneUI.addMessageComponents. This method, if message is String, calls itself recursively with substring from 0 to position of first new line character. This way you have multi line message.
Hope this helps, Pawel
PS. You can break text on JLabel if you make it in html and use <br>.
posted 13 years ago
thanks for your reply. I found the code you mentioned in the src.zip of the JDK. That clears up a lot. I understand the difference now. I did now about using html in JLabels already. I had just hoped to have one single way of using multiple lines. Guess Swing is not that simple.
Sun Certified Developer for the Java 2 Platform
Sun Certified Enterprise Architect for the Java Platform, Enterprise Edition 5
What a show! What atmosphere! What fun! What a tiny ad!