title: Java - Change font in a JTextPane containing HTML
body: <p>I have a JTextPane and I have some text within that JTextPane. However, because I have been using HTML within the Pane, the text seems to have been automatically changed to Times New Roman. </p>
  
  <p>I'm trying to set the font type within the JTextPane to the default font of the GUI (the font of the JTextPane when it's not HTML). However I can't just set the font to one font because it differs from operating system, therefore I want to find a way to get the default font and then change the text I have to the default font. </p>
  
  <p>To demonstrate how the text is swapped to Times New Roman when converted, the following code is the format I have used. How could I change it to achieve my goal?</p>
  
  <pre><code>import javax.swing.JFrame;
  import javax.swing.JTextPane;
  
  
  public class GUIExample {
  
      public static void main(String[] args) {
  
          JFrame frame = new JFrame("My App");
          frame.setSize(300,300);
          JTextPane pane = new JTextPane();
          pane.setContentType("text/html");
          pane.setText("&lt;html&gt;&lt;b&gt;This is some text!&lt;/b&gt;&lt;/html&gt;");
          frame.add(pane);
  
          frame.setVisible(true);
  
      }
  
  }
  </code></pre>
  
  <p>Thanks!</p>