• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JLabel - How to get text on two lines?

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mateus,

Haven't got time for the golf bit, but the html tip is great - cheers!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic