title: Extending JLabel in Java Swing to use a given font (super usage in extended classes)
body: <p>I am trying to create a new class <code>JXLabel</code> which inherits <code>JLabel</code>. Difference is that this extended class will assign a default font for the label.</p>
  
  <p>If I try this:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class JXLabel extends JLabel {
  
      Font f = new Font("Segoe UI", Font.PLAIN, 6);
  
      public JXLabel() {    
          super();
          this.setFont(f);
      }  
  
      public JXLabel(Icon icon) {
          super(icon);
          this.setFont(f);
      }  
  
      public JXLabel(Icon icon, int horizontalAlignment) {
          super(icon, horizontalAlignment);
          this.setFont(f);
      }  
  
      public JXLabel(String text) {
          super(text);
          this.setFont(f);
      }  
  
      public JXLabel(String text, Icon icon, int horizontalAlignment) {
          super(text, icon, horizontalAlignment);
          this.setFont(f);
      }  
  
      public JXLabel(String text, int horizontalAlignment) {
          super(text, horizontalAlignment);
          this.setFont(f);
      }  
  }
  </code></pre>
  
  <p>I would expect new labels created as <strong>JXLabel</strong> to have this default font, but they do not.</p>
  
  <p>If I create a regular JLabel and do:</p>
  
  <pre class="lang-java prettyprint-override"><code>myLabel.setFont(new Font("Segoe UI", Font.PLAIN, 6));
  </code></pre>
  
  <p>It works. Any tip on what is wrong in the extended class? Thanks.</p>