• Post Reply Bookmark Topic Watch Topic
  • New Topic

Text width.  RSS feed

 
Sonara Rahul
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have a label whose text is set by setText method with html tags embedded.
So some of characters is bold & some plain in the label text.
I need to get the font style of each & every character of the label text.It may be bold or plain or some other style.
So pl.. help out.
with regards,
SonaraRahul.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTML tags just tell the JLabel how to render the text that is on it... if you do a getText() on the JLabel it will return the HTML tags along with the string rendered.

You'll need to parse the HTML tags to find out which tags are affecting what parts of the text. While you are parsing the text, if you find a <B>, you'll know that the text is starting to be rendered bold, if you find a </B> you'll know that the text has stopped being bold.

-Nate
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!