title: Populate a jcombobox in netbeans 7.1
body: <p>I want to add a combo box which populates from a mysql database in netbeans 7.1.I did a simple implementation like follows, but this coding doesn't work.</p>
  
  <pre><code>private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
      try 
      {
          Connection con = DriverManager.getConnection("jdbc:mysql://localhost/combo","root","root123");
          Statement stmnt = (Statement) con.createStatement();
          String SQL = "SELECT * FROM items";
          ResultSet rs = stmnt.executeQuery(SQL);
          while(rs.next()) 
          {
              jComboBox1.addItem(rs.getString("itemcode"));
          }
      } 
      ...
  }
  </code></pre>
  
  <p>How can I solve this problem.</p>