dcsimg
Tag bold in JTextPane
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, March 15, 2002 12:39 AM

I'm making a HTML Editor. I use a JTextPane whose type is "text/html". I can change attribute of a word, for example:

			
JTextPane pane = ...;

........

try {
SimpleAttributeSet neg = new SimpleAttributeSet();
neg.addAttribute(HTML.Tag.B, pane.getSelectedText());
int p0 = pane.getSelectionStart();
int p1 = pane.getSelectionEnd();
doc.setCharacterAttributes(p0, p1-p0, neg, false);
}catch(Exception exception) {;}


However, later, I want know if this word is in bold or no. How can I know it?

About | Sitemap | Contact