title: Can anyone spot why i have a nullpointerexception?
body: <p>I really don't understand why i get a nullpointerexception on this one. Been struggling with this code for hours now and really can't figure it out..</p>
  
  <p>Hope you see anything, and let me know if you need any more code.</p>
  
  <pre><code>public void createForest() {
          String name = textField_name.getText();
          String location = textField_location.getText();
          String squaretemp = textField_squaremetre.getText();
          String treesorts = textField_treesorts.getText();
          String pricetemp = textField_price.getText();
  
          // Convert
          double squaremetre = Double.parseDouble(squaretemp);
          double price = Double.parseDouble(pricetemp);
  
          forestOwnerCtr.createForest(name, location, squaremetre, treesorts, price);
          forestOwnerCtr.printForestList();
      }
  </code></pre>
  
  <p>My error in console is:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
  at GUI.CreateForest.createForest(CreateForest.java:131)
  at GUI.CreateForest$2.actionPerformed(CreateForest.java:104)
  at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
  at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
  at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
  at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
  at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
  at java.awt.Component.processMouseEvent(Component.java:6414)
  at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
  at java.awt.Component.processEvent(Component.java:6179)
  at java.awt.Container.processEvent(Container.java:2084)
  at java.awt.Component.dispatchEventImpl(Component.java:4776)
  at java.awt.Container.dispatchEventImpl(Container.java:2142)
  at java.awt.Component.dispatchEvent(Component.java:4604)
  at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
  at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4279)
  at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4209)
  at java.awt.Container.dispatchEventImpl(Container.java:2128)
  at java.awt.Window.dispatchEventImpl(Window.java:2492)
  at java.awt.Component.dispatchEvent(Component.java:4604)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717)
  at java.awt.EventQueue.access$400(EventQueue.java:82)
  at java.awt.EventQueue$2.run(EventQueue.java:676)
  at java.awt.EventQueue$2.run(EventQueue.java:674)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
  at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
  at java.awt.EventQueue$3.run(EventQueue.java:690)
  at java.awt.EventQueue$3.run(EventQueue.java:688)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:687)
  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
  </code></pre>
  
  <p>If i System.out.println all of the variables non of them is empty. You think the problem is inside the ForestOwnerCtr? or?</p>
  
  <p>After making breakpoints and ended on this one:</p>
  
  <pre><code>forestOwnerCtr.createForest(name, location, squaremetre, treesorts, price);
  </code></pre>
  
  <p>My Controller looks like this</p>
  
  <pre><code>public void createForest(String name, String location, double squaremetre, String treesorts, double price) {
      forestCon.createForest(name, location, squaremetre, treesorts, price);
  }
  </code></pre>
  
  <p>And this sends us to container that looks like this:</p>
  
  <pre><code>public void createForest(String forName, String forLocation, double forSquareMetre, String forNatureOfTrees, double forPrice)
      {
          Forest forestnew = new Forest(forName, forLocation, forSquareMetre, forNatureOfTrees, forPrice);
          forests.add(forestnew);
      }
  </code></pre>