title: how to use a JComboBox object as a parameter of a java method?
body: <p>I get an error message due to the JComboBox parameter I am using in my code.
  The method is:
  <code>public void miseAJourComboBox(JComboBox&lt;String&gt; jcb)</code></p>
  <p>The message is:</p>
  <pre class="lang-none prettyprint-override"><code>error: cannot find symbol
  public void miseAJourComboBox(JComboBox&lt;String&gt; jcb){
  symbol: class JComboBox
  location: class FrameAchat
  </code></pre>
  <p>and the code (simplified) is:</p>
  <pre><code>public class FrameAchat extends javax.swing.JFrame {
   
      public ConnectionSQL connectionSQL;
   
      /** Creates new form FrameAchat */
      public FrameAchat() {
          connectionSQL = new ConnectionSQL();
          System.out.println(&quot;passe par constructeur de achat&quot;);
          initComponents();
      }
   
   
      /** This method is called from within the constructor to
       * initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is
       * always regenerated by the Form Editor.
       */
      @SuppressWarnings(&quot;unchecked&quot;)
      // &lt;editor-fold defaultstate=&quot;collapsed&quot; desc=&quot;Generated Code&quot;&gt;                          
      private void initComponents() {
   
          jLabelFicheAchat = new javax.swing.JLabel();
          jComboIdPdt = new javax.swing.JComboBox&lt;&gt;();
          jLabelMarque = new javax.swing.JLabel();
          jLabelModele = new javax.swing.JLabel();
          jLabelAnnee = new javax.swing.JLabel();
          jLabelPrix = new javax.swing.JLabel();
          jComboIdFrs = new javax.swing.JComboBox&lt;&gt;();
          jLabelNom = new javax.swing.JLabel();
          jComboQte = new javax.swing.JComboBox&lt;&gt;();
          jLabelQte = new javax.swing.JLabel();
          Achat = new javax.swing.JButton();
   
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
   
          jLabelFicheAchat.setFont(new java.awt.Font(&quot;Tahoma&quot;, 0, 18)); // NOI18N
          jLabelFicheAchat.setText(&quot;Creation Achat&quot;);
   
          jComboIdPdt.setModel(new javax.swing.DefaultComboBoxModel&lt;&gt;(new String[] { &quot;Item 1&quot;, &quot;Item 2&quot;, &quot;Item 3&quot;, &quot;Item 4&quot; }));
   
          jLabelMarque.setText(&quot;jLabel1&quot;);
   
          jLabelModele.setText(&quot;jLabel1&quot;);
   
          jLabelAnnee.setText(&quot;jLabel1&quot;);
   
          jLabelPrix.setText(&quot;jLabel1&quot;);
   
          jComboIdFrs.setModel(new javax.swing.DefaultComboBoxModel&lt;&gt;(new String[] { &quot;Item 1&quot;, &quot;Item 2&quot;, &quot;Item 3&quot;, &quot;Item 4&quot; }));
   
          jLabelNom.setText(&quot;jLabel1&quot;);
   
          jComboQte.setModel(new javax.swing.DefaultComboBoxModel&lt;&gt;(new String[] { &quot;Item 1&quot;, &quot;Item 2&quot;, &quot;Item 3&quot;, &quot;Item 4&quot; }));
   
          jLabelQte.setText(&quot;Quantité:&quot;);
   
          Achat.setText(&quot;ACHETER&quot;);
   
          org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
          getContentPane().setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
              .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                  .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                  .add(jLabelFicheAchat, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 177, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                  .add(91, 91, 91))
              .add(layout.createSequentialGroup()
                  .add(24, 24, 24)
                  .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                      .add(layout.createSequentialGroup()
                          .add(jComboIdPdt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                          .add(53, 53, 53)
                          .add(jLabelMarque)
                          .add(18, 18, 18)
                          .add(jLabelModele)
                          .add(28, 28, 28)
                          .add(jLabelAnnee)
                          .add(18, 18, 18)
                          .add(jLabelPrix))
                      .add(layout.createSequentialGroup()
                          .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                              .add(jComboIdFrs, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                              .add(jLabelQte))
                          .add(53, 53, 53)
                          .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                              .add(jComboQte, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                              .add(jLabelNom)
                              .add(Achat))))
                  .addContainerGap(66, Short.MAX_VALUE))
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
              .add(layout.createSequentialGroup()
                  .add(21, 21, 21)
                  .add(jLabelFicheAchat)
                  .add(18, 18, 18)
                  .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                      .add(jComboIdPdt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                      .add(jLabelMarque)
                      .add(jLabelModele)
                      .add(jLabelAnnee)
                      .add(jLabelPrix))
                  .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                  .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                      .add(jComboIdFrs, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                      .add(jLabelNom))
                  .add(18, 18, 18)
                  .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                      .add(jComboQte, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                      .add(jLabelQte))
                  .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 76, Short.MAX_VALUE)
                  .add(Achat)
                  .add(51, 51, 51))
          );
   
          pack();
      }// &lt;/editor-fold&gt;                        
   
      /**
       * @param args the command line arguments
       */
      public static void main(String args[]) {
          /* Set the Nimbus look and feel */
          //&lt;editor-fold defaultstate=&quot;collapsed&quot; desc=&quot; Look and feel setting code (optional) &quot;&gt;
          /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
           * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
           */
          try {
              for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                  if (&quot;Nimbus&quot;.equals(info.getName())) {
                      javax.swing.UIManager.setLookAndFeel(info.getClassName());
                      break;
                  }
              }
          } catch (ClassNotFoundException ex) {
              java.util.logging.Logger.getLogger(FrameAchat.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (InstantiationException ex) {
              java.util.logging.Logger.getLogger(FrameAchat.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (IllegalAccessException ex) {
              java.util.logging.Logger.getLogger(FrameAchat.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
              java.util.logging.Logger.getLogger(FrameAchat.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
          //&lt;/editor-fold&gt;
   
          /* Create and display the form */
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new FrameAchat().setVisible(true);
              }
          });
      }
   
      // Variables declaration - do not modify                     
      private javax.swing.JButton Achat;
      private javax.swing.JComboBox&lt;String&gt; jComboIdFrs;
      private javax.swing.JComboBox&lt;String&gt; jComboIdPdt;
      private javax.swing.JComboBox&lt;String&gt; jComboQte;
      private javax.swing.JLabel jLabelAnnee;
      private javax.swing.JLabel jLabelFicheAchat;
      private javax.swing.JLabel jLabelMarque;
      private javax.swing.JLabel jLabelModele;
      private javax.swing.JLabel jLabelNom;
      private javax.swing.JLabel jLabelPrix;
      private javax.swing.JLabel jLabelQte;
      // End of variables declaration                   
   
      public void miseAJourComboBox(JComboBox&lt;String&gt; jcb){
          System.out.println(&quot;hi&quot;);
      }
   
   
  }
  </code></pre>