Manix
-
Modifié le 12 févr. 2022 à 20:08
Twinuts
Messages postés5374Date d'inscriptiondimanche 4 mai 2003StatutModérateurDernière intervention 3 mars 2023
-
28 févr. 2022 à 10:40
Bonjour, j'ai travail sur la gestion de la caisse, j'aimerai avoir la somme ou le total de la colonne solde de mon JTable mais jai ne y arrive pas.
voici l'erreur qu'on m'affiche:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 6 >= 6 at java.util.Vector.elementAt(Vector.java:427) at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:277) at javax.swing.JTable.convertColumnIndexToModel(JTable.java:2496) at javax.swing.JTable.getValueAt(JTable.java:2638) at lagestion_sdm.T_CAISSE.calculSomme(T_CAISSE.java:404) at lagestion_sdm.T_CAISSE.totActionPerformed(T_CAISSE.java:1000) at lagestion_sdm.T_CAISSE.access$300(T_CAISSE.java:18) at lagestion_sdm.T_CAISSE$5.actionPerformed(T_CAISSE.java:611)
Merci bcp Monsieur KX pour votre reponse mais je ne arrive pas a me retrouver, svp qu'est ce que je peut ajouter dans la méthode calculsomme pour que sa marche: les codes sont la:
*
int calculSomme(){
int som=0;
int nbLign=tble.getRowCount();
for(int i=0; i<nbLign; i++){
int solde=Integer.getInteger(tble.getValueAt(i, 5).toString());
som= som+solde;
}
return som;
}
Modifié le 21 mars 2022 à 19:58
*
Aide-moi Svp.