UPDATE 20/1/2011: I have updated the source code to allow you to set the text colour and background colour of the returned panels. I have also added a .jar and read me so you can simply import the .jar into your project and start using the code, see multilinelabel_update.zip
GUI's in Java can baffle people particularly when dealing with awt after having already learnt Swing. One thing that many people struggle with when dealing with awt is the lack of those extra features that Swing has added. In my case as a programming designer I wanted to display information in a label but I wanted to have it in a multiline format. Awt has no inbuilt multi-line label capacity, so I wrote a class that would allow me to split a given string string at a given maximum character width without splitting any words.
You can download the .java file below. If you wish to use my code please acknowledge me and let me know how you have used it, I am always interested to know how and what it was used for. I have made it Java 2.0 & J2ME compatible, if you are looking to use it with a later Java library I have put some suggestions in the comments.
|File Size: ||6 kb|
|File Type: || zip|
|File Size: ||4 kb|
|File Type: || java|