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
| public void chargeDates(Date dates[], int jourDebut, int echelle)
{
calendar = Calendar.getInstance();
//if(echelle==1 || echelle==2 || echelle==3){
//calendar.set(annee, mois, jour); //-----------------------
//~ System.out.println("CALENDAR = "+calendar);
System.out.println("Jour="+jour+" Mois="+mois+" Annee="+annee);
if (echelle==0){
calendar.add(Calendar.DATE, jourDebut);
for(int i=0; i<41; i++)
{
dates[i]=calendar.getTime();
calendar.add(Calendar.DATE, +1);
//if(dates[i]==appli.date_debut[i]){
//art.setBounds(posFleche+60*i, 50, 200, 200);
// System.out.println("BIIIIIM");}
}
}
if (echelle==1){
calendar.add(Calendar.WEEK_OF_MONTH, jourDebut);
for(int i=0; i<41; i++)
{
dates[i]=calendar.getTime();
calendar.add(Calendar.WEEK_OF_MONTH, +1);
}
}
if (echelle==2){
calendar.add(Calendar.MONTH, jourDebut);
for(int i=0; i<41; i++)
{
dates[i]=calendar.getTime();
calendar.add(Calendar.MONTH, +1);
}
}
if (echelle==3){
//calendar.set(annee, calendar.get(calendar.MONTH), calendar.get(calendar.DATE)); //-----------------------
calendar.add(Calendar.YEAR, jourDebut);
for(int i=0; i<41; i++)
{
dates[i]=calendar.getTime();
calendar.add(Calendar.YEAR, +1);
}
}
//calendar.getInstance();
}
public void positionneLabels()
{
for(int i=0; i<41; i++)
{
// les 31 dates sont espacées de ### pixels
if (echelle==0 || echelle==1){
labDates[i].setBounds(posLabel20+(i-20)*120, 30, 120, 40);}
if (echelle==2){
labDates[i].setBounds(posLabel20+(i-20)*120, 30, 120, 40);}
if (echelle==3){
labDates[i].setBounds(posLabel20+(i-20)*120, 30, 120, 40);}
}
// la flèche est posisionnée sur la date du jour (label20)
fleche.setBounds(posFleche, 70, 28, 64);
art.setBounds(posFleche-50, 100, 50, 50);
}
public void rechargeLabels(Date dates[])
{
for(int i=0; i<41; i++)
{
if (echelle==0){
labDates[i].setText("lab"+i+":"+simpleFormatDay.format(dates[i]));
labDates[i].setBounds(posInitLabel20+(i-20)*120, 30, 120, 40);}//("lab"+i+":"+sim......
if (echelle==1){
labDates[i].setText("<html>lab"+i+": Semaine du <br>"+simpleFormatWeek.format(dates[i]));
labDates[i].setBounds(posInitLabel20+(i-20)*120, 30, 120, 40);}
else if (echelle==2){
labDates[i].setText("<html>lab"+i+": Mois de <br>"+simpleFormatMonth.format(dates[i]));
labDates[i].setBounds(posInitLabel20+(i-20)*120, 30, 120, 40);}
else if (echelle==3){
labDates[i].setText("lab"+i+":"+"Année "+simpleFormatYear.format(dates[i]));
labDates[i].setBounds(posInitLabel20+(i-20)*120, 30, 120, 40);}
}
fleche.setBounds(posFleche, 70, 28, 64);
} |
Partager