title: How to pass object from superclass constructor in Java?
body: <p>I created my Frames and I want to extend the panel from superclass with some new buttons. How can I pass the panel object from the superclass? This is first frame:</p>
  
  <pre><code>public class FirstFrame extends JFrame {
      public FirstFrame(String title) throws HeadlessException {
          super(title);
          ....
          JPanel btnPanel = new JPanel();
          ....
      }
  }
  </code></pre>
  
  <p>And the second frame, where I want to add additional button:</p>
  
  <pre><code>public class SecondFrame extends FirstFrame {
      public SecondFrame(String title) throws HeadlessException {
          super(title);
          JButton btnMove = new JButton("Przenies zajecia");
          JButton btnDispMode = new JButton("Tryb wyświetlania");
          btnPanel.add(btnMove); // doesn't work
      }
  }  
  </code></pre>