title: Exception in thread "main" java.lang.StackOverflowError JPanel
body: <p>I'm getting this error when I try to run program that creates a Panel inside a Frame</p>
  
  <p>I didn't paste some parts of code like variable declaration because I didn't have much space!</p>
  
  <pre><code>Exception in thread "main" java.lang.StackOverflowError
      at java.util.HashMap.hash(HashMap.java:338)
          at java.util.HashMap.get(HashMap.java:556)
          at javax.swing.UIDefaults$TextAndMnemonicHashMap.get(UIDefaults.java:1244)
          at javax.swing.UIDefaults.getFromResourceBundle(UIDefaults.java:288)
          at javax.swing.UIDefaults.get(UIDefaults.java:162)
          at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:64)
          at javax.swing.UIDefaults.getUI(UIDefaults.java:753)
          at javax.swing.UIManager.getUI(UIManager.java:1016)
          at javax.swing.JPanel.updateUI(JPanel.java:126)
          at javax.swing.JPanel.&lt;init&gt;(JPanel.java:86)
  </code></pre>
  
  <h2>LoginWindow.java:</h2>
  
  <p>Creates the main panel, divided into sub panels which contain labels,textfields and button        </p>
  
  <pre><code>public class LoginWindow extends JPanel {
  
      public LoginWindow() {
  
          LoginWindow p1 = new LoginWindow();
          LoginWindow p2 = new LoginWindow();
          LoginWindow p3 = new LoginWindow();
          LoginWindow p4 = new LoginWindow();
          LoginWindow p5 = new LoginWindow();
          LoginWindow p0 = new LoginWindow();
  
          p1.setLayout(new BorderLayout());
          p2.setLayout(new BorderLayout());
          p3.setLayout(new GridLayout(3, 1, 1, 1));
          p4.setLayout(new GridLayout(3, 1, 1, 1));
          p5.setLayout(new GridBagLayout());
          p0.setLayout(new BorderLayout());
  
          password = new JPasswordField();
          email = new JTextField();
          label_password = new JLabel("Password");
          label_email = new JLabel("Email");
  
          setLayout(new BorderLayout());
  
          add(p0,BorderLayout.NORTH);
          add(p1,BorderLayout.CENTER);
          add(p2,BorderLayout.SOUTH);
  
          sign_in = new JLabel("Sign in");
          sign_in.setFont(new Font("Serif", Font.PLAIN, 25));
          sign_in.setForeground(Color.red);
          p0.add(sign_in,BorderLayout.CENTER);
  
          p1.add(p3, BorderLayout.SOUTH);
          p1.add(p4, BorderLayout.NORTH);     
  
          p1.setBorder(BorderFactory.createLineBorder(Color.gray, 1, true));
  
          p4.add(label_email);
          p4.add(email);
  
          p3.add(label_password);
          p3.add(password);
  
          button = new Button("Create Account");
          button.setPreferredSize(new Dimension(120, 30));
          button.addActionListener(new ActionListener() {
  
              @Override
              public void actionPerformed(ActionEvent e) {
                  if(blank.equals(password.getPassword().toString()) || blank.equals(email.getText())){
                      JOptionPane.showMessageDialog(null, "Email or password missing !");
                  }else {
                      DataBase db = new DataBase();
                      db.insertData(password.getPassword().toString(), email.getText());
                  }
              }
          });
  
          p5.add(button);
          p2.add(p5,BorderLayout.CENTER);
      }
  }
  </code></pre>
  
  <h2>window.java:</h2>
  
  <p>Creates an object from window class, and adds the created panel to the tabbed pane, all inside the main frame</p>
  
  <pre><code>public class window extends JFrame {
  
      public window() {
          super("Window");
          setSize(300,230);
          setVisible(true);
          setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
          //setResizable(false);
          setLocation(600, 100);
  
          JTabbedPane tabPane = new JTabbedPane();
          LoginWindow panel = new LoginWindow();
          tabPane.addTab("Sign in",panel );
  
          add(tabPane);
          //pack();
      }
  
      public static void main(String[] args) {
          window frame = new window();
      }
  }
  </code></pre>