title: Why do I get a NullPointerException when I start my GUI?
body: <p>I have coded a gui for my CRUD Program, and when I want to run it I get:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      at gui.guimain$1.run(guimain.java:477)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
  </code></pre>
  
  <p>Thats the code where the NPE comes from:</p>
  
  <pre><code>public static void main(String[] args){
      javax.swing.SwingUtilities.invokeLater(new Runnable() {
          public void run(){
                  maingui.showStart();// thats the line with the Exception
          }
      });
  }
  </code></pre>
  
  <p>and thats the method showStart():</p>
  
  <pre><code>public void showStart(){
      mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      mainFrame.getContentPane().removeAll();
      tabstructure.removeAll();
      Produkt filter=new Produkt();
  
      JPanel P=new JPanel();
      P=Produktgui(0, filter);
      JPanel R=new JPanel();
      R=Billgui(0);
      JPanel nR=new JPanel();
      nR=Billgui(0);
  
      tabstructure.addTab("e", P);
      tabstructure.addTab("Bills", R);
      tabstructure.addTab("Pay bill", nR);
      mainFrame.getContentPane().add(tabstructure);
      mainFrame.validate();
      mainFrame.repaint();
      mainFrame.pack();
      mainFrame.setVisible(true);
  }
  </code></pre>
  
  <p>Why do I get a <code>NullPointerException</code>?</p>