Thursday, July 12, 2007

Wrapping Text In JLabels

I recently picked up Swing while I was developing Tweeter!, a Java client for Twitter. A nifty little trick that I found out about was how to wrap the text inside a JLabel.

JLabels support HTML markup. So all you need to do is surround the text with HTML tags ( <html> and </html> ) and voila! The contents wrap around! If you need it to be centered, simply add a <center> tag. It's that simple!

1 comment:

Jal Pari said...


PK Domain is the best Web Hosting Company in Pakistan. We are provided Domain Registration and web designing, Web Hosting, Reseller Hosting, Dedicated Server and VPS Hosting you can also buying at affordable price. Give your business an online presence with us today at www.pkdomain.com.pk.