i am using setText("Some String"); to add text to a label. How do i get the text to go to a new line?
\n does not work.
Printable View
i am using setText("Some String"); to add text to a label. How do i get the text to go to a new line?
\n does not work.
I was about to throw in the towel when I found this:
http://java.sun.com/docs/books/tutor...nts/label.html
Page down for:
"Using HTML on a Label
Have you ever wanted to put multiple lines on a label? Have you ever wanted to make part of a label bold or italic? Now you can. As of Swing 1.1.1 Beta 1, JLabel supports multiple lines, multiple fonts, and a whole lot more because you can specify a label's text using HTML."
It looks like a hassle compared to just having "\n" in the middle of your string, but it boasts HTML "text".
For a minute there, I thought you could embed an entire web page on a label, but that didn't seem to work. In the "Warning", it says, "...supports HTML text in the desired component.", so I guess it's not as robust as I initially thought. But there is another class for web pages anyway.
<br> worked for me
Cool, thanks a lot. I hope you didn't go to too much trouble finding that. But thanks a lot, i am just learning java, and i had no idea how to do that
Like my new signature says, I'm actually getting paid for this.
I came across that problem with Label before, then I went to JLabel yesterday and noticed that the same problem is still there (the API actually says "single line"). Then I caught that tutorial which actually impressed me.
Depending on Java's speed, I may be asking you some C++ questions for dedicated platform dependant apps.
Ok, i will help if i can. Do you have a lot of experience with Java? You seem to, because you usually answer most of the questions that people post in here.
Let's just say, more recent Java than recent C/C++. I'll be visiting those forums if and when Java doesn't deliver on my performance needs.
But the dreamer that I am may never really get the project off of the ground anyway.