title: JComboBox triggering null pointer even though it was not called on?
body: <p>working on a school project. My program has an action listener for a jcombobox that once i hit submit, clears the box and hides it. Thats when it says null pointer, even though I'm not using it or clicking it after I clear it. Also, it only happens the first time I clear it.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>JComboBox sidComboBox = new JComboBox();
          sidComboBox.setFont(new Font("Lantinghei TC", Font.PLAIN, 15));
          sidComboBox.setBounds(139, 127, 222, 27);
          contentPane.add(sidComboBox);
          
           btnSubmit.addActionListener (new ActionListener ()  //adding action listener to the button component and creating a specific action performed method (override) for the button
                   {
                       public void actionPerformed (ActionEvent e)
                       {        
                        
                        
                        if (btnSelect == 5)
                        {
                         sidComboBox.setEnabled(false);
                         sidComboBox.setVisible(false);
                         fnComboBox.setEnabled(false);
                         lnComboBox.setEnabled(false);
                         pnComboBox.setEnabled(false);
                         fnComboBox.setVisible(false);
                         lnComboBox.setVisible(false);
                         pnComboBox.setVisible(false);
                        }
                        
                        btnAdd.setEnabled(true);  
                        btnEdit.setEnabled(true);  
                        btnDelete.setEnabled(true);  
                        btnSearch.setEnabled(true);  
                        btnViewAll.setEnabled(true);    
                        
                        TAFirstName.setVisible(false);
                     TALastName.setVisible(false);
                     TAStudentID.setVisible(false);
                     TAPhoneNumber.setVisible(false);
                     lblFirstName.setVisible(false);
                     lblLastName.setVisible(false);
                     lblPhoneNumber.setVisible(false);
                     lblStudentId.setVisible(false);
                     btnSubmit.setVisible(false);
                     btnSubmit.setEnabled(false);
                     btnEditor.setVisible(false);
                           btnEditor.setEnabled(false);
  
                  TAFirstName.setEditable(false);
                  TALastName.setEditable(false);
                  TAStudentID.setEditable(false);
                  TAPhoneNumber.setEditable(false);
                  
                  TAFirstName.setText(null);
                        TALastName.setText(null);
                        TAStudentID.setText(null);
                        TAPhoneNumber.setText(null);
                        
                        sidComboBox.setVisible(false);
                        sidComboBox.setEnabled(false);
                        sidComboBox.removeAllItems();
                        fnComboBox.setVisible(false);
                        fnComboBox.setEnabled(false);
                        fnComboBox.removeAllItems();
                        lnComboBox.setVisible(false);
                        lnComboBox.setEnabled(false);
                        lnComboBox.removeAllItems();
                        pnComboBox.setVisible(false);
                        pnComboBox.setEnabled(false);
                        pnComboBox.removeAllItems();
                        
                  btnSelect = 0;
  
                       }
                   }
           );  
     
     sidComboBox.addActionListener (new ActionListener ()  //adding action listener to the button component and creating a specific action performed method (override) for the button
                   {
                       public void actionPerformed (ActionEvent e)
                       {      
                        int check = db.getNum() - 1;
                           if (check == -1) {
                            
                        }
                        
                        else {
                         int studentID = (int) sidComboBox.getSelectedItem();
                         int num = db.getNum();
                  
                         for (int b1 = 0; b1 &lt; num; b1++)
                         {
                          int nom = (db.studentList[b1].getStudentID());
                   
                          if (studentID == nom)
                          {
                           fnComboBox.setSelectedItem((db.studentList[b1]).getFirstName());
                           lnComboBox.setSelectedItem((db.studentList[b1]).getLastName());
                           pnComboBox.setSelectedItem((db.studentList[b1]).getPhoneNumber());
                           break;
                          }                            
                         }
                         
                         
                        }
                  
                       }
                   }
           );    </code></pre>
  </div>
  </div>
  </p>
  
  <p>The error happens at this line specifically, not when I use it but when I hit the submit button.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>int studentID = (int) sidComboBox.getSelectedItem();</code></pre>
  </div>
  </div>
  </p>
  
  <p>I know its null, but I'm not calling on the box when its null. So why is it telling me its null??</p>