Bonjour , voila je suis debutant en java je fais un programme avec une base de données mysql Pour effectuer une requête l'utilisateur selectionne un élément ds un Jcombobox s'affiche alors dans un 2ème Jcombobox les éléments qui correspondent à cette première saisie.
Mon problème est que j'arrive pas a charger la 2eme Jcombobox merci de m'aider et voici un bout de mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
void jComboBox_Opé_actionPerformed(ActionEvent e) {
      choix   = jComboBox_Opé.getSelectedItem().toString();   
  }
 
  {
try {
  Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql://localhost/gestion_globale";
        String User="root";
        String Passwd="";
        Connection con=DriverManager.getConnection(url,User,Passwd);
 
          jComboBox_Opé.removeAllItems();
          stmt = con.createStatement();
          String query="SELECT CODE_OPE FROM operation";
          ResultSet rs= (ResultSet) stmt.executeQuery(query);
 
          while (rs.next()) {
             jComboBox_Opé.addItem(rs.getString("CODE_OPE"));
 
          }
          con.close();
          }
 
          catch(ClassNotFoundException e) {
          System.out.println("Erreur lors du chargement du pilote: "+e);
          }
          catch (Exception e) {
          System.out.println(e + "Error");
        }
}
 
      {
     try {
       Class.forName("com.mysql.jdbc.Driver");
             String url="jdbc:mysql://localhost/gestion_globale";
             String User="root";
             String Passwd="";
             Connection con=DriverManager.getConnection(url,User,Passwd);
 
              jComboBox_pseudo.removeAllItems();
               stmt2 = con.createStatement();
               String query2= "Select PSEUDO FROM employe WHERE CODE_OPE=?";
                PreparedStatement stmt2=con.prepareStatement(query2);
 
               stmt2.setString(1,choix);
               ResultSet rs= (ResultSet) stmt2.executeQuery(query2);
 
               while (rs.next()) {
                  jComboBox_pseudo.addItem(rs.getString("PSEUDO"));
 
               }
 
               con.close();               }
 
               catch(ClassNotFoundException e) {
               System.out.println("Erreur lors du chargement du pilote: "+e);
               }
 
 
             catch (Exception e) {
               System.out.println(e + "Error");
             }
     }
 
 
}

Merci d'avance