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
|
class DonneeTable extends JPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
private ResultSet rs;
DonneeTable(){
try {
Connexion base = Connexion.getNewInstance();
Statement stmt = base.getConn();
ResultSet rs =stmt.executeQuery("select * from admin ");
TableModel conf = new Affiche(rs);
JTable tablo = new JTable(conf);
tablo.addMouseListener(new MouseAdapter(){
public void mouseClicked(java.awt.event.MouseEvent evt){
if(evt.getClickCount()==2){
JOptionPane.showMessageDialog(null,"");
}
}
});
JScrollPane avecAsc = new JScrollPane(tablo);
add(avecAsc);
stmt.close();
base.dbDisconnect();
} catch (SQLException e) {
} catch (ClassNotFoundException e) {
}
}
//client
DonneeTable(String titre) throws IOException{
try {
Connexion base = Connexion.getNewInstance();
Statement stmt = base.getConn();
rs = stmt.executeQuery("select * from client ");
TableModel conf = new Affiche(rs);
JTable tablo = new JTable(conf);
tablo.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent evt){
if(evt.getClickCount()==2){
//tablo.get;
JOptionPane.showMessageDialog(null,"");
}
}
});
JScrollPane avecAsc = new JScrollPane(tablo);
add(avecAsc);
stmt.close();
base.dbDisconnect();
} catch (SQLException e) {
} catch (ClassNotFoundException e) {
}
}
//ici c'est lorsqu'on rentre le numéro du client à consulter
DonneeTable(int numc) throws IOException{
try {
Connexion base = Connexion.getNewInstance();
Statement stmt = base.getConn();
rs = stmt.executeQuery("select * from client where num_cli='"+numc+"'");
TableModel conf = new Affiche(rs);
JTable tablo = new JTable(conf);
JScrollPane avecAsc = new JScrollPane(tablo);
add(avecAsc);
stmt.close();
base.dbDisconnect();
} catch (SQLException e) {
} catch (ClassNotFoundException e) {
}
} |
Partager