setting font of selected text in a JTextPane
I just can't seem to figure this crap out. I already had to convert all my code into a JTextPane just so I could change the style of text, and now I can't get it to work.
Here is the junk I have so far:
Code:
public void processBoldText()
{
MutableAttributeSet keyWord = new SimpleAttributeSet();
StyleConstants.setBold(keyWord, false);
int left = textArea2.getSelectionStart();
int right = textArea2.getSelectionEnd();
int length = right - left;
doc.setCharacterAttributes(left,length,keyWord, true);
}
Re: setting font of selected text in a JTextPane
Just so you don't get confused, textArea2 is my JTextPane...lol
Also doc is the document I created from the textpane
Re: setting font of selected text in a JTextPane
Never mind. I figured it out.