title: How can I prevent my jComboBox from resetting?
body: <p>I have a <code>ResultSet</code>. This <code>ResultSet</code> is filling a <code>JComboBox</code> with data like this:</p>
  
  <pre><code>DatabaseHandler dh = new DatabaseHandler();
  
  public ResultSet Klanten;
  
  public BestellingenNieuwPanel() {
      initComponents();
      //Removes all items from KlantBox.
      KlantBox.removeAllItems();
      //Removes all from ProductBox.
      ProductBox.removeAllItems();
          try {
          Klanten = dh.getDataFromDB("select * from klanten");
          while (Klanten.next()) {
              String strKlanten = Klanten.getString("Achternaam");
              KlantBox.addItem(Klanten.getString(3));
          }
  
      } catch (Exception e) {
          System.out.println(e.getMessage());
      }
  </code></pre>
  
  <p>This workes just fine. But, whenever I try to loop through <code>ResultSet</code> Klanten again like this:</p>
  
  <pre><code>private void KlantBoxActionPerformed(java.awt.event.ActionEvent evt) {  
  
      if(Klanten != null){
          String strSelected = KlantBox.getSelectedItem().toString();            
          try {
              while(Klanten.next()){
                  String KlantVoornaam = Klanten.getString(1);
                  String KlantAchternaam = Klanten.getString(2);
                  String KlantWoonplaats = Klanten.getString(4);
                  if(strSelected == KlantAchternaam){
                      txtKlantNaam.setText(KlantAchternaam);
                      txtKlantWoonplaats.setText(KlantWoonplaats);
                  }
              }
          } catch (SQLException ex) {
          }
  
      }
  }      
  </code></pre>
  
  <p>My <code>JComboBox</code> Klanten only has it's last value.
  I've fiddled around with the Klanten.next() function and found that that function is the source of the problem.</p>
  
  <p>Are there any other ways to loop through a <code>ResultSet</code>? 
  Or is there a way to loop through a <code>ResultSet</code> WITHOUT resetting my <code>JComboBox</code>?</p>