• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multi line in a java.awt.Label

 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to multi line in a java.awt.Label?

i wish to display a a sentence, the problem is the string doesnt wrap around the Label control.


thanks
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try using html tags to display the information eg

<html>my line<br>anotherline</html>
 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir thank you,


but i needed to display the information inside a java.awt.Label?

help.
 
luc comeau
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey cyrus, i think rachel is a woman...maybe not but anyways lol..
She was correct, a JLable can render html,soooooooo...just put that inside ur caption of the JLabel ie.
JLabel j= new JLabel("<html>First line of text <br> Second line of text</html>");

i think thats right atleast.
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the LineBreakMeasurer class. Its api includes an example.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe McTigue,
Your post was moved to a new topic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic