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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
package teste_4;
import java.awt.Color;
import javax.swing.*;
import java.util.*;
import java.awt.Dimension;
public class Tab_boulier_numerote extends JTable
{
Hashtable hash_stok;
Stocage sto_tirages;//Stocage est un vecteur
public Tab_boulier_numerote(Stocage sto_vecteur)//Stocage est un vecteur
{
super(51,13);
hash_stok = new Hashtable(600);// 2 constructeurs on utilise celui qui récupère la capassité
sto_tirages = sto_vecteur;
get_donnees();
set_donnees();
}
private void set_donnees()
{
int i,j;
int int_replacement = 0;
String str_clef = "";
Object obj_sortis;
//L'entête reste a faire
setValueAt("ch", 0, 0);
setValueAt("Tout", 0, 1);
setValueAt("Musique", 0, 2);
setValueAt("B1", 0, 3);
setValueAt("B1 musique", 0, 4);
setValueAt("B2", 0, 5);
setValueAt("B2 musique", 0, 6);
setValueAt("B3", 0, 7);
setValueAt("B3 musique", 0, 8);
setValueAt("B4", 0, 9);
setValueAt("B4 musique", 0, 10);
setValueAt("B5", 0, 11);
setValueAt("B5 musique", 0, 12);
for (i = 1; i <= 50;i++)
{
int_replacement = 3;
this.setValueAt(String.valueOf(i), i, 0);
str_clef = i+"g";//************Num général
obj_sortis = hash_stok.get(str_clef);
setValueAt(obj_sortis, i, 1);
str_clef = i+"m";//************musique général
obj_sortis = hash_stok.get(str_clef);
setValueAt(obj_sortis, i, 2);
for( j = 1; j<=5;j++)
{
str_clef = i+"b"+j;//************Num
obj_sortis = hash_stok.get(str_clef);
setValueAt(obj_sortis, i, int_replacement);
int_replacement++;
str_clef = i+"m"+j;//************Musique
obj_sortis = hash_stok.get(str_clef);
setValueAt(obj_sortis, i, int_replacement);
int_replacement++;
}
}
}
private void get_donnees()
{
c_euro c_e = new c_euro(); //création du vecteur pour traiter les données
//c_euro est une class constituer d'un tableau et d'autres donnes
String str_ligne = "";
String str_clef = "";
int int_donnee = 0;
String str_donnee = "";
int [][] int_musique = new int[6][51];
int i,j,k,l;
int int_numero=0;
Object obj_compt= "";
int int_compt = 0;
String str_compt = "";
for( j = 0 ; j<= 5 ; j++)//
{
for (i = 0; i <= 50 ; i++)
{
int_musique[j][i]= 0;
}
}
for ( i=1 ; i <= 50 ; i++)
{
str_clef = i+"g";
hash_stok.put(str_clef, int_donnee);
str_clef = i+"m";
hash_stok.put(str_clef, str_donnee);
for (j=1 ; j <= 5 ; j++)
{
str_clef = i+"b"+j;
hash_stok.put(str_clef, int_donnee);
str_clef = i+"m"+j;
hash_stok.put(str_clef, str_donnee);
}
}
for( i = 0;i<= sto_tirages.size()-1;i++)
{
c_e = (c_euro) sto_tirages.get(i);
for ( j = 1 ;j<=5;j++)
{
int_numero = c_e.nb[j-1];
str_clef = int_numero+"g";//************Num au général
obj_compt = hash_stok.get(str_clef);
str_compt = String.valueOf(obj_compt);
int_compt = Integer.parseInt(str_compt);
int_compt++;
hash_stok.put(str_clef, int_compt);
int_musique[0][int_numero]++; //***********musique au général
str_clef = int_numero+"m";
str_donnee = (String)hash_stok.get(str_clef);
str_donnee = str_donnee + "-"+int_musique[0][int_numero];
hash_stok.put(str_clef, str_donnee);
int_musique[0][int_numero]=0;
str_clef = int_numero+"b"+j;//************Num
obj_compt = hash_stok.get(str_clef);
str_compt = String.valueOf(obj_compt);
int_compt = Integer.parseInt(str_compt);
int_compt++;
hash_stok.put(str_clef, int_compt);
int_musique[j][int_numero]++; //***********musique
str_clef = int_numero+"m"+j;
str_donnee = (String)hash_stok.get(str_clef);
str_donnee = int_musique[j][int_numero]+ "-"+ str_donnee ;
hash_stok.put(str_clef, str_donnee);
int_musique[j][int_numero]=0;
}
for( k = 0 ; k<= 5 ; k++)//
{
for (l = 0; l <= 50 ; l++)
{
int_musique[k][l]++;
}
}
}
}
} |
Partager