title: changing the font in a JTextArea for different lines
body: <p>I would like to append differnt lines of font to the JTextArea, however the last font seems to override the other.</p>
  
  <p>Please help...  </p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  
  @SuppressWarnings("serial")
  public class test extends JFrame {
  
  private static JTextArea referenceTextArea = new JTextArea(10, 10);
  private JPanel panel = new JPanel();
  
  public test() {
      this.add(panel);
      panel.add(referenceTextArea);
  }
  
  public static void textTest() {
      referenceTextArea.setFont(new Font("Serif", Font.BOLD, 15));
      referenceTextArea.append("line1");
      referenceTextArea.append("\n");
  
      referenceTextArea.setFont(new Font("Serif", Font.ITALIC, 30));
      referenceTextArea.append("line2");
      referenceTextArea.append("\n");
  }
  
  public static void main(String[] args) {
      test frame = new test();
      frame.setVisible(true);
      frame.setSize(400, 400);
      frame.setResizable(false);
      frame.setLocationRelativeTo(null);
      frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
  
      textTest();
  }
  }
  </code></pre>