Thanks to devsundar I found out how to make the selected text in a JEditorPane
bold/underline/italics/whatever. How can I set the Font Size
of the selected Text in a JEditorPane
?
My Current Method Of changing bold/italics/etc:
AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY,
StyleConstants.StrikeThrough, true);
pane.getStyledDocument().setCharacterAttributes(pane.getSelectionStart(),
pane.getSelectionEnd(), aset, true);
There's a working example here that uses StyledEditorKit.FontSizeAction
and related classes in StyledEditorKit
.