Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

New line inside a JLabel

I know that this sounds like a noobie question but...
I created a JLabel that has a paragraph in it. When I run the program, it prints the paragraph in one line. How do I make it so I can insert new lines? Since this is a GUI, I can't use println. I've tried the following:

...
JLabel label = new JLabel("BLAH BLAH BLAH BLAH BLAH BLAH BLAH\n" +
"BLAH BLAH BLAH BLAH BLAH BLAH BLAH");
...

The "\n" doesn't work either. Help pl :) x?
[480 byte] By [Shsep] at [2007-11-11 9:58:52]
# 1 Re: New line inside a JLabel
This page ( http://java.sun.com/docs/books/tutorial/uiswing/components/html.html) might be of some help.
unimac at 2007-11-11 22:32:10 >
# 2 Re: New line inside a JLabel
Try to work out like this

JLabel lb=new JLabel("<html>h......<br></br>a........</html>");
mr.rajeshyadav at 2007-11-11 22:33:10 >