Bonjours tous le monde voila j'ai une erreur dans mon programme que j'ai pas pus resoudre
voila j'ai ici 4 radio bouton chaque 2 dans un boutton groupe et dans dac ontenainre different
le prebleme et quant j'utilise les 2 dernieres ca marche pas et me genere une erreur "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException"
mais si je commance par utiliser les 2 premiers ca marche pour eux et pour les derniere
Merci d'avance
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91 class StateListener implements ActionListener{ public void actionPerformed(ActionEvent e) { String client; Connection con=null; PreparedStatement ps=null; ResultSet rs=null; al.clear(); try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/appStage","root","boumacmilan"); ps = con.prepareStatement("select Nom from client"); rs = ps.executeQuery(); while(rs.next()) { client=rs.getString("Nom"); al.add(client); }; } catch(Exception f) { System.out.println("wa mossiba hadi2 "+f); } if(jRadioEclient.isSelected()) { jFieldNom.setVisible(false); jComboBoxBomClient.setVisible(true); JBCModifier.setVisible(true); jBCEnregistrer.setVisible(false); ValuCombobox(); } if(jRadioNclient.isSelected()) { jFieldNom.setVisible(true); jComboBoxBomClient.setVisible(false); JBCModifier.setVisible(false); jBCEnregistrer.setVisible(true); } if(jRadioNewPay.isSelected()) { jComboBoxEPays.setVisible(false); jButtonModifierPays.setVisible(false); jFieldNomPays.setVisible(true); jBAddPays.setVisible(true); } if(jRadioEPays.isSelected()) { al.clear(); jComboBoxEPays.setVisible(true); jButtonModifierPays.setVisible(true); jFieldNomPays.setVisible(false); jBAddPays.setVisible(false); try{ ps = con.prepareStatement("select pays from pays"); rs = ps.executeQuery(); while(rs.next()) { client=rs.getString("Nom"); al.add(client); }; } catch(Exception f) { System.out.println("wa mossiba hadi2 "+f); } for(int p=0;p<al.size();p++) jComboBoxEPays.addItem(al.get(p)); } } private void ValuCombobox() { for(int p=0;p<al.size();p++) jComboBoxBomClient.addItem(al.get(p)); } }
Partager