title: Class constructor calling another
body: <p>I'd like to have 2 constructor with one that calls the other.</p>
  
  <p>example :</p>
  
  <pre><code>public class MyButton extends JButton {
  private final ImageIcon neutralIcon;
  private final ImageIcon pressedIcon;
  private final ImageIcon rollOverIcon;
  
      public MyButton(String n, 
                      String p, 
                      String r, 
                      Dimension d)
      {
          neutralIcon     = new ImageIcon(this.getClass().getResource(n));
          pressedIcon     = new ImageIcon(this.getClass().getResource(p));
          rollOverIcon    = new ImageIcon(this.getClass().getResource(r));
          this.setIcon(neutralIcon);
          this.setPressedIcon(pressedIcon);
          this.setRolloverIcon(rollOverIcon);
  
          this.setFocusPainted(false);
          this.setContentAreaFilled(false);
          this.setSize(d);
      }
  
      public MyButton(String n, 
                      String p, 
                      String r)
      {   
          this(n,p,r,this.getPreferredSize()); // COMPILE ERROR
      }
  
  }
  </code></pre>
  
  <p>I need to get the preferredSize but NetBeans said something like "cannot reference this before supertype constuctor has been called".</p>
  
  <p>I tried the 'super' thing but it still gives me error.</p>
  
  <p>My friend told me to put the getPreferredSize into a variable but it didn't work.</p>
  
  <pre><code>Dimension d = this.getPreferredSize();
  this(n,p,r,d); // COMPILE ERROR
  </code></pre>