title: JTextPane setForeground when HTML is on
body: <p>I have a <code>JTextPane</code> and I want to change it's <code>foreground</code> sometimes. The problem is, if to switch the <code>ContentType</code> of <code>JTextPane</code> to <code>text/html</code>, my call <code>jTextPane.setForeground(myColor)</code> does not appear. <strong>How can I fix that?</strong></p>
  
  <p>SSCCE:</p>
  
  <pre><code>public class TextAreaTest {
      public static void main(String[] a) {
          final JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          final JTextPane textArea = new JTextPane();
          textArea.setEditable(false);
          textArea.setFocusable(false);
  
          textArea.setText("&lt;html&gt;First line text&lt;br&gt;Second line text&lt;/html&gt;");
  
          final JPanel panel = new JPanel(new FlowLayout());
  
          final JCheckBox htmlOnOff = new JCheckBox("HTML");
          htmlOnOff.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  textArea.setContentType(htmlOnOff.isSelected() ? "text/html" : "text/plane");
                  textArea.setText("&lt;html&gt;First line text&lt;br&gt;Second line text&lt;/html&gt;");
              }
          });
  
          JToggleButton buttonRed = new JToggleButton("Red");
          buttonRed.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  textArea.setForeground(Color.RED);
              }
          });
  
          JToggleButton buttonGreen = new JToggleButton("Green");
          buttonGreen.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  textArea.setForeground(Color.GREEN);
              }
          });
  
          JToggleButton buttonBlue = new JToggleButton("Blue");
          buttonBlue.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  textArea.setForeground(Color.BLUE);
              }
          });
  
          panel.add(htmlOnOff);
          panel.add(buttonRed);
          panel.add(buttonGreen);
          panel.add(buttonBlue);
  
          ButtonGroup buttonGroup = new ButtonGroup();
          buttonGroup.add(buttonRed);
          buttonGroup.add(buttonBlue);
          buttonGroup.add(buttonGreen);
  
          JPanel contentPane = new JPanel();
          contentPane.setLayout(new BorderLayout(0, 0));
          contentPane.add(panel, BorderLayout.NORTH);
          contentPane.add(textArea, BorderLayout.CENTER);
  
          frame.setContentPane(contentPane);
          frame.setUndecorated(true);
          Dimension size = new Dimension(275, 80);
          frame.setSize(size);
          frame.setPreferredSize(size);
  
          SwingUtilities.invokeLater(new Runnable() {
              @Override
              public void run() {
                  frame.setVisible(true);
                  System.out.println(frame.getSize());
              }
          });
      }
  }
  </code></pre>
  
  <p><strong>UPDATE#1</strong>
  I noticed that <code>JLabel</code> is able to do what I want. But I can't use it :(</p>