salut tout le monde j'ai un tableau et un composant jtextfield
je cherche à faire si je tape un caractère sur clavier le curseur se positionne sur une ligne de tableau
est ce que ça c'est possible
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
 
 
jTextField.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent e) {
System.out.println("keyReleased()"); // TODO Auto-generated Event stub keyReleased()
try{					    	 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance(); 
String url= "jdbc:odbc:ODBC1";
String user = "user";
String pass = "pass";
Connection connection = DriverManager.getConnection(url,user,pass);
Statement instruction = connection.createStatement();
 String sql = "select GPNOPR,GPDN,GPLN,GPSEX   from  GPM  where  GPMAT like   '%"+jTextField.getText()+"%'  ";
 ResultSet resultat = instruction.executeQuery(sql);
  while (resultat.next()){ 	
   nom       = resultat.getString("GPNOPR");  
adresse       = resultat.getString("GPDN");
  lieu       = resultat.getString("GPLN");
 sex       = resultat.getString("GPSEX");
}
jLabel5.setText(nom);
 jLabel51.setText(adresse);
 jLabel52.setText(lieu);
					        }
catch (Exception ex) {
    System.out.println("jjjjjjjjjjj "+ex.getMessage());
   ex.printStackTrace() ;
}
			});
mon tableau est jTable (je veux pointe sur une ligne