title: Passing a value of combobox to a jframe from another jframe
body: <p>I have 2 JFrames, one of which has a combo box. I'm trying to get the selected index of that combo box and pass the value to my other JFrame form.</p>
  
  <p>I tried doing this: (in my NewJFrame.java)</p>
  
  <pre><code>int num = NewJFrame2.cmbNum.getSelectedIndex(); //NewJFrame2 = 2nd JFrame
  </code></pre>
  
  <p>so that I can do this:</p>
  
  <pre><code>if(num == 0)
  //code
  </code></pre>
  
  <p>but I'm having an error on that line. (Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException)</p>
  
  <p>I have no idea why because I really don't know how to pass values between 2 JFrames.</p>