Set logical style; replaces paragraph style's parent
import java.awt.Color; import javax.swing.JTextPane; import javax.swing.text.Style; import javax.swing.text.StyleConstants; public class Main { public static void main(String[] argv) throws Exception { JTextPane textPane = new JTextPane(); Style style = textPane.addStyle(null, null); StyleConstants.setForeground(style, Color.red); textPane.setLogicalStyle(style); style = textPane.addStyle(null, null); StyleConstants.setForeground(style, Color.red); textPane.setLogicalStyle(style); } }