aspose file tools*
The moose likes Beginning Java and the fly likes JLabel - How to get text on two lines? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JLabel - How to get text on two lines?" Watch "JLabel - How to get text on two lines?" New topic
Author

JLabel - How to get text on two lines?

James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
Does anyone know how I can get a JLabel to use two lines of text? I have tried using /n but it doesn't treat it as a line-break...

If it can't be done with JLabel, does anyone know which component I should be using?

Thanks,
James
Mateus Hooker
Greenhorn

Joined: Jul 25, 2005
Posts: 4
String s = "<html>If you're feeling lazy<br>use html markup<br>then play golf...</html>";
JLabel label = new JLabel(s);
James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
Mateus,

Haven't got time for the golf bit, but the html tip is great - cheers!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JLabel - How to get text on two lines?