2

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);
Community
  • 1
  • 1
Primm
  • 1,347
  • 4
  • 19
  • 32

1 Answers1

3

There's a working example here that uses StyledEditorKit.FontSizeAction and related classes in StyledEditorKit.

image

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045