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
| private void deplace(int i) {
try {
txtid.setText(model.getValueAt(i, 0).toString());
txtnm.setText(model.getValueAt(i, 1).toString());
txtpr.setText(model.getValueAt(i, 2).toString());
txtda.setText(model.getValueAt(i, 3).toString());
txtad.setText(model.getValueAt(i, 4).toString());
txttel.setText(model.getValueAt(i, 5).toString());
txtstat.setSelectedItem(model.getValueAt(i, 6).toString());
txtfnct.setSelectedItem(model.getValueAt(i, 7).toString());
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Erreur de deplacement" + e.getLocalizedMessage());
}
}
private void afficher() {
try {
stmt = con.obtenirconnection().createStatement();
rs = stmt.executeQuery("SELECT * from profil,fonction,statut where fonction.idFonction=profil.idFonction and statut.idStatut=profil.idStatut");
while (rs.next()) {
model.addRow(new Object[]{rs.getString("identifiant"), rs.getString("nom"), rs.getString("prenom"), rs.getString("sexe"),
rs.getString("adresse"), rs.getString("tel"), rs.getString("nomFonction"), rs.getString("nomStatut")});
}
table.setModel(model);
} catch (SQLException e) {
System.err.println(e);
}
} |
Partager