How can i continue a very long sentence on the second line in a JLabel?

/n does not work
/t does not work as well

I dont want the html thing cause i have a simple application.

Thank you

Recommended Answers

All 5 Replies

The only way I know is HTML, but that's really easy - eg
myJLabel.setText("<HTML><This is a test<BR>on two lines</HTML>");

commented: straight to point with example +2

Ok i will try it... i let you know if i get it to work.

Thank you very much, thats the one i was looking for.

Do you know how to apply it with /t?

/t isn't going to do anything for you, you'll have to use HTML codes for formatting & layout. JLabels support many ordinary HTML tags, but not all. You just have to try a few things and see what works to give the result you need.

ok thank you very much again you realy helped me out!

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.