title: Add component in a JPanel subclass
body: <p>I want to create a JPanel subclass thats holds some JLabels. I started to write my code but I immediatly find a big problem. Component added to the JPanel subclass are not visible (or they are not added to JPanel I don' t kano). This is the code of the JPanel Subclass:</p>
  
  <pre><code>public class ClientDetails extends JPanel
  {
  
      private JLabel nameAndSurname = new JLabel ("Name &amp; Surname");
      private JLabel company = new JLabel ("Company");
  
      private JPanel topPanel = new JPanel ();
  
      public ClientDetails ()
      {
  
          this.setBackground(Color.white);
          this.setLayout(new BorderLayout());
  
          topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.Y_AXIS));
          topPanel.add(nameAndSurname);
          topPanel.add(company);
  
          this.add(topPanel,BorderLayout.PAGE_START);
  
      }
  
  }
  </code></pre>