Bonjour,

J'ai un vecteur d'entiers que je souhaite afficher et j'ai des String comme étant des entêtes dans la méthode affiche.

Le Bloc
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
    for (int z=0;z<n;z++)
    {
        System.out.println(vecteur.elementAt(z));
    }
fait l'affichage de ce vecteur.

Voici la méthode affiche
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
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
public static void affiche(Vector<Integer>vecteur, int n)throws JDOMException, IOException
    {TestXml xml = new TestXml() ; 
    Element root = xml.getRoot("C:\\Users\\faten\\Desktop\\Tentative FiNALParcTool\\xmlparser\\src\\default.editeurparctool.xml") ;
    ArrayList<ContainTask> TaskC = xml.getContainTask(root);
    ArrayList<Place> Places = xml.getPlaces(root);
    ArrayList <ArrayList> Matrice = new ArrayList<ArrayList>();
    Matrice.add(0,Places);
     ArrayList<Place> Procstab = new ArrayList<Place>(); 
      ArrayList<Place> TitoTi = new ArrayList<Place>();  // if  (p.getIplace == p.getJplaace) ==> titoTi
      ArrayList<Place> TitoTj = new ArrayList<Place>(); 
        int nbTache= TaskC.size();
        int nbLigne=15;
        int nbPlaces=Places.size();
        for ( int i= 0 ; i < nbTache; i++ ) //ligne 
        { 
        for ( int l = 0 ; l <nbLigne; l++ ) 
        {if (l ==0){System.out.println("P" +(i+1)+"Uncreated      " );}
          if (l ==1){System.out.println("P" +(i+1)+"DeadLine       " );}
           if (l ==2){System.out.println("P" +(i+1)+"RemainingPeriod" );}
           if (l ==3){System.out.println("P" +(i+1)+"Created        " );} 
           if (l ==4){System.out.println("P" +(i+1)+"ElapsedPeriod  " );}
           if (l ==5){System.out.println("P" +(i+1)+"ReceivedData   " );}
           if (l ==6){System.out.println("P" +(i+1)+"Ready          " );}
            if (l ==7){System.out.println("P" +(i+1)+"Disabled       " );}
            if (l ==8){System.out.println("P" +(i+1)+"Activated      " );}
           if (l ==9){System.out.println("P" +(i+1)+"GetProc        " );}
          if (l ==10){System.out.println("P" +(i+1)+"IncreExec      " ); }
          if (l ==11){System.out.println("P" +(i+1)+"Maker          " ); }
          if (l ==12){System.out.println("P" +(i+1)+"e" +(i+1)+"             " ); }
           if (l ==13){System.out.println("P" +(i+1)+"ReleaseProc    " );}
           if (l ==14){System.out.println("P" +(i+1)+"DataToSend     " );}
        }
        }
         ArrayList s = Matrice.get(0);
         for (int j = 0; j < s.size(); j++) 
         { 
             Place  p = new Place();  
             p = (Place) s.get(j) ; 
 
              if(p.getTypePlace()==9) // proc
             {      
                     Procstab.add(p) ; 
 
              }//System.out.print(Procstab);
              if(p.getTypePlace()==10)
             { 
 
                 TitoTi.add(p) ;  
 
              }//System.out.print(TitoTi);
             if(p.getTypePlace()==11)
             { 
                     TitoTj.add(p) ;  
              }
         }
 
    //System.out.println();
 
    for ( int l = nbTache*nbLigne ; l <=nbTache*nbLigne+nbPlaces ; l++ ) 
 
    {int tailleProcstab =Procstab.size();
    int tailleTitoTi=TitoTi.size();
    int tailleTitoTj=TitoTj.size();
    int nb = nbTache*nbLigne+tailleTitoTi; 
    int nb1 =nb+tailleProcstab ;
 if(l>=nbTache*nbLigne && l <(nbTache*nbLigne+tailleTitoTi))   //TitoTi
 {    
     for(l=nbTache*nbLigne;l <(nbTache*nbLigne+tailleTitoTi);l++)
     {
 
    System.out.println(TitoTi.get(l-nbTache*nbLigne)+"            " );//T1toT1.....T1toT13 
 
 }
 }
 
     if(l>=nb && l < (nb + tailleProcstab+1)&& l <nb1) //  Proc
      {
         for(l=nb;l <(nb + tailleTitoTi+1)&& l <nb1;l++)
     {
 
             System.out.println(Procstab.get(l-nb)+"           ");//proc 1/2/3/4 
     }
 
     }
 
 
        if(l>=nb1 && l < (nb1+tailleTitoTj))//TitoTj
 
         {
          for(l=nb1;l <(nb1+tailleTitoTj);l++)
          {
            System.out.println(TitoTj.get(l-nb1)+"           ");
          }
 
        }
    }
        for (int z=0;z<n;z++)
        {
                System.out.println(vecteur.elementAt(z));
        }
    }
L'affichage erroné est
P1Uncreated
P1DeadLine
P1RemainingPeriod
P1Created
P1ElapsedPeriod
P1ReceivedData
P1Ready
P1Disabled
P1Activated
P1GetProc
P1IncreExec
P1Maker
P1e1
P1ReleaseProc
P1DataToSend
P2Uncreated
P2DeadLine
P2RemainingPeriod
P2Created
P2ElapsedPeriod
P2ReceivedData
P2Ready
P2Disabled
P2Activated
P2GetProc
P2IncreExec
P2Maker
P2e2
...
Quelqu'un saurait-il m'indiquer comment faire pour afficher devant chaque String la valeur int appropriée ?

Merci d'avance pour votre aide.