Bonjour,
J'ai un problème lors de l'insertion du contenu d'un FormattedTextField, la fonction d'insertion fonctionne sauf le champ du mask il ne s'enregistre pas:
voilà la déclaration :
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 publicvoid insertInfo()throwsException{ try{ int codeNat = getNat(); String query ="INSERT INTO info (id,name,code_nat) VALUES (?,?,?)"; stat = cnx.prepareStatement(query); stat.setString(1, txtId.getText()); stat.setString(2, txtName.getText());//masked formatted field stat.setInt(3, codeNat); stat.execute(); Update_table(); }catch(SQLException ex){ JOptionPane.showMessageDialog(null,ex); } finally{ stat.close(); } }
JFormattedTextField txtName =newJFormattedTextField();
mask =newMaskFormatter("########/##");
mask.install(txtName);
la compilation ne génère aucune exception seulement le champs reste vide
Partager