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.
multilinelabel_update.zip
File Size: 6 kb
File Type: zip
Download File

multilinelabel-v01.java
File Size: 4 kb
File Type: java
Download File

 


Comments

08/09/2012 02:02

Great information about the multiline labels in awt in the java. I think people should like it . I like this information too and also i am waiting for some new updates.

Reply
08/09/2012 05:34

Nice blog for the java programming.The blog gives a easy procedure for programmers.Thanks a lot for the blog post.

Reply



Leave a Reply