感谢devsundar,我发现了如何使选定的文本以JEditorPane粗体/下划线/斜体/任何形式显示。如何Font Size在 a 中设置所选文本的JEditorPane?
我当前更改粗体/斜体/等的方法:
AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY,
StyleConstants.StrikeThrough, true);
pane.getStyledDocument().setCharacterAttributes(pane.getSelectionStart(),
pane.getSelectionEnd(), aset, true);
