Jtable+rafraichir

cs_KERKENNAH Messages postés 15 Date d'inscription lundi 26 juillet 2004 Statut Membre Dernière intervention 5 août 2005 - 17 avril 2005 à 19:51
Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 - 17 avril 2005 à 20:30
bonjour à tous
je suis un etudiant et j'ai besoin d'aide àproposde jtable
on faite j'ai une application qui joue le role d'un serveur qui recoit des trames et qui les affiche dans jtable
mais le probleme c que je veut qu il ya un rafraichisement de la table chaque fois q'une trame et afficher en faitmon application se bloque pour un memont puis elle les affiche tous ensemble etmoi je veux un affichage en temps reel
j'ai essayé repaint mais le probleme persiste
voici le code

//***************
void jB_start_actionPerformed(ActionEvent e) {


try{


while(true){



Date date = new Date();
socket.receive(packet);
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat timef = new SimpleDateFormat("HH:mm");
String s = timef.format(new Date(System.currentTimeMillis()));


data[0] = sdf.format(date).toString();
data[1] = s;
String packet_string = new
String(log_buffer, 0, 0, packet.getLength());


data[3]= packet.getAddress().getHostAddress().toString();
data[5]=packet_string ;
System.out.println(packet_string+s);
statsTableModel.addRow(data);
statsTableModel.fireTableDataChanged();
jTable1.repaint();









}
}
catch(Exception et) {
JOptionPane.showMessageDialog(null, "Wrong password");
}


}

1 réponse

Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 111
17 avril 2005 à 20:30
salut,





tu as essayé jtable.fireTableCellUpdated(row, col),

ou jtable.fireTableRowsUpdated(row, row),

ou encore jtable.fireTableRowsInserted(row, row)



pour info



il y a aussi jtable.fireTableRowsDeleted(row, row)



sinon va sur ce lien :

http://java.sun.com/docs/books/tutorial/uiswing/components/table.html



perso il m'a bcp appris


WORA
0
Rejoignez-nous