Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Newline char in JLabel

 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Is it possible to view set of lines with the "New line char" in a JLabel ?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. JLabels can display HTML, and to do this, you have to use HTML. Something like

JLabel myLabel = new JLabel("<html>Hello,<br>World</html>");

will show up on two lines.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info Ernest.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!