Déclaration tableau 2 dimensions
Bonjour, je souhaite afficher à partir d'une base de données les données qui respectent une certaine contrainte.
J'ai besoin pour cela d'avoir un tableau par rapport à mon interface Java/Swing .
Code:
1 2 3 4 5
| you can initialize the row dimension without initializing the columns but not vice versa
int[][] myArray = new int[5][];
// illegal
int[][] myArray = new int[][5]; |
Or ici l'application que je ne vais pas développer fait ceci :
Et donc je ne peux pas selon le théorème cité au dessus faire
Object data[][] = new Object[][10];
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
/** Vector of Object[], this are the data of the table */
Object data[][] = new Object[100][10];
data[i][0] = (String)v.elementAt(1) + " " + (String)v.elementAt(2); // Nom d'invité
data[i][1] = (String)v.elementAt(3) + " " + (String)v.elementAt(4); // Nom de bénéficaire
data[i][2] = (String)v.elementAt(7); // Categorie
data[i][3] = (String)v.elementAt(10); // Organisation
data[i][4] = (String)v.elementAt(9); // Fonction
data[i][5] = (String)v.elementAt(15); // Vip
data[i][6] = (String)v.elementAt(16); // Type Badge
data[i][7] = (String)v.elementAt(13); // Venus
data[i][8] = (String)v.elementAt(12); // Cadeau
data[i][9] = (String)v.elementAt(8); // User |
Suffirait-t-il alors que j'inverse colonne et ligne dans ma matrice?
merci.