A JTextArea‘s tab size can easily be set using setTabSize(int).
Is there a similar way to do it with a JEditorPane?
Right now, text with tabs in my pane looks like:
if (stuff){ more stuff; }
And, I’d prefer a much smaller tab stop:
if (stuff){ more stuff; }
As JEditorPane is designed to support different kinds of content types, it does not provide a way to specify a ‘tab size’ directly, because the meaning of that should be defined by the content model. However when you use a model that’s a PlainDocument or one of its descendants, there is a ‘tabSizeAttribute’ that provides what you are looking for.
Example:
From the Javadoc: