COMMANDE "CAL" SOUS *UX

Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 - 19 sept. 2007 à 20:03
dje_jay Messages postés 58 Date d'inscription mercredi 17 décembre 2003 Statut Membre Dernière intervention 16 février 2011 - 26 sept. 2007 à 17:15
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/44124-commande-cal-sous-ux

dje_jay Messages postés 58 Date d'inscription mercredi 17 décembre 2003 Statut Membre Dernière intervention 16 février 2011 2
26 sept. 2007 à 17:15
"Au secours !" pour?
Ca a l'air de fonctionner...
C'est le décalage qui t'en*? =>C'est prévu pour tourner en terminal "normal" avec une fonte de type courrier, ou [fixed width] en ts cas...
yvkoe Messages postés 32 Date d'inscription jeudi 20 septembre 2007 Statut Membre Dernière intervention 19 janvier 2009
25 sept. 2007 à 11:46
Au secours !
voila ce que cela donne une fois comilé et executé:
2007
janvier février mars avril
lu ma me je ve sa di lu ma me je ve sa di lu ma me je ve sa di lu ma me je ve sa di
01
01 02 03 04 05 06 07 01 02 03 04 01 02 03 04 02 03 04 05 06 07 08
08 09 10 11 12 13 14 05 06 07 08 09 10 11 05 06 07 08 09 10 11 09 10 11 12 13 14 15
15 16 17 18 19 20 21 12 13 14 15 16 17 18 12 13 14 15 16 17 18 16 17 18 19 20 21 22
22 23 24 25 26 27 28 19 20 21 22 23 24 25 19 20 21 22 23 24 25 23 24 25 26 27 28 29
29 30 31 26 27 28 26 27 28 29 30 31 30

mai juin juillet août
lu ma me je ve sa di lu ma me je ve sa di lu ma me je ve sa di lu ma me je ve sa di
01 02 03 01
01 02 03 04 05 06 04 05 06 07 08 09 10 02 03 04 05 06 07 08 01 02 03 04 05
07 08 09 10 11 12 13 11 12 13 14 15 16 17 09 10 11 12 13 14 15 06 07 08 09 10 11 12
14 15 16 17 18 19 20 18 19 20 21 22 23 24 16 17 18 19 20 21 22 13 14 15 16 17 18 19
21 22 23 24 25 26 27 25 26 27 28 29 30 23 24 25 26 27 28 29 20 21 22 23 24 25 26
28 29 30 31 30 31 27 28 29 30 31

septembre octobre novembre décembre
lu ma me je ve sa di lu ma me je ve sa di lu ma me je ve sa di lu ma me je ve sa di
01 02 01 02
03 04 05 06 07 08 09 01 02 03 04 05 06 07 01 02 03 04 03 04 05 06 07 08 09
10 11 12 13 14 15 16 08 09 10 11 12 13 14 05 06 07 08 09 10 11 10 11 12 13 14 15 16
17 18 19 20 21 22 23 15 16 17 18 19 20 21 12 13 14 15 16 17 18 17 18 19 20 21 22 23
24 25<26 27 28 29 30 22 23 24 25 26 27 28 19 20 21 22 23 24 25 24 25 26 27 28 29 30
29 30 31 26 27 28 29 30 31
C'st un petit peu décalé...
voila le code une fois les modif exécutée:

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.Vector;

public class Cal {
static String semyear[][][] = new String[13][6][8];

/**
* @param args
*/
public static void main(String[] args) {
int annee = 0;
int dayofweek = 0;
int weekofmonth = 0;
int month = 0;
int index = 0;
Vector vDayNames = new Vector();
Vector vMonthNames = new Vector();
String MonthTitle = "";

Date dt1;
try {
Calendar epoch = GregorianCalendar.getInstance(TimeZone
.getDefault());// TimeZone.getTimeZone("Europe/Paris"));
if (args.length != 0)
annee = Integer.parseInt(args[0]);
else
annee = epoch.get(Calendar.YEAR);

// init table
for (int i = 0; i < 13; i++)
for (int j = 0; j < 6; j++)
for (int k = 0; k < 8; k++)
semyear[i][j][k] = " ";

System.out.println(annee);

// Set epoch to 1st jan of the year
dt1 = stringToDate("01/01/" + annee, "dd/MM/yyyy");
epoch.setTime(dt1);

// fill the vector vDayNames with short names of days of the week
DateFormat dateFormat = new SimpleDateFormat("EEE");
index = 1;// sunday 1st
while (index < 8) {
if (epoch.get(Calendar.DAY_OF_WEEK) == index) {
vDayNames.add(dateFormat.format(epoch.getTime()));
index++;
}
epoch.add(Calendar.DAY_OF_YEAR, 1);// while epoch isn't a
// sunday
}

// re initialize to 1st jan of the year
dt1 = stringToDate("01/01/" + annee, "dd/MM/yyyy");
epoch.setTime(dt1);

// fill the vector vMonthNames with full month names
dateFormat = new SimpleDateFormat("MMMMM");
index = Calendar.JANUARY;
while (index <= Calendar.DECEMBER) {
vMonthNames.add(dateFormat.format(epoch.getTime()));
index++;
epoch.add(Calendar.MONTH, 1);
}

// re initialize to 1st jan of the year
dt1 = stringToDate("01/01/" + annee, "dd/MM/yyyy");
epoch.setTime(dt1);

// fill the table of the current year
while (epoch.get(Calendar.YEAR) == annee) {
dayofweek = epoch.get(Calendar.DAY_OF_WEEK);
weekofmonth = epoch.get(Calendar.WEEK_OF_MONTH);
month = epoch.get(Calendar.MONTH);
if (epoch.get(Calendar.DAY_OF_MONTH) < 10)
semyear[month][weekofmonth][dayofweek] = "0"
+ Integer
.toString(epoch.get(Calendar.DAY_OF_MONTH));
else
semyear[month][weekofmonth][dayofweek] = Integer
.toString(epoch.get(Calendar.DAY_OF_MONTH));
epoch.add(Calendar.DAY_OF_YEAR, 1);
}

// Cycle for Lines of months
for (int monthboucle = 0; monthboucle < 3; monthboucle++) {
epoch = GregorianCalendar.getInstance(TimeZone.getDefault());
// *************************************************************************************
// Print month names
MonthTitle = ((String) vMonthNames.get(0 + monthboucle * 4));
for (int i = MonthTitle.length(); i < 22; i++)
MonthTitle += " ";// up to char pos 22
MonthTitle += ((String) vMonthNames.get(1 + monthboucle * 4));
for (int i = MonthTitle.length(); i < 44; i++)
MonthTitle += " ";// up to char pos 44
MonthTitle += ((String) vMonthNames.get(2 + monthboucle * 4));
for (int i = MonthTitle.length(); i < 66; i++)
MonthTitle += " ";// up to char pos 66
MonthTitle += ((String) vMonthNames.get(3 + monthboucle * 4));
System.out.println(MonthTitle);

// Show days name
for (int i = 0; i < 4; i++) {
for (int j = epoch.getFirstDayOfWeek() - 1; j < 7; j++)
System.out.print(((String) vDayNames.get(j)).substring(
0, 2)
+ " ");
if (epoch.getFirstDayOfWeek() > 1)
for (int j = 0; j < epoch.getFirstDayOfWeek() - 1; j++)
System.out.print(((String) vDayNames.get(j))
.substring(0, 2)
+ " ");
System.out.print(" ");
}
System.out.println("");

// print a line of months
for (weekofmonth = 0; weekofmonth < 6; weekofmonth++)// 6
// lines
// per
// months
{
for (month = 0; month < 4; month++) // 4 months per line
{
for (int day = epoch.getFirstDayOfWeek(); day < 8; day++) // 7
// days
// per
// week
{
System.out
.print(semyear[month + monthboucle * 4][weekofmonth][day]);
if ((annee == epoch.get(Calendar.YEAR))
&& // test to put a "<" after the current
// day
((month + monthboucle * 4) == epoch
.get(Calendar.MONTH))
&& (semyear[month+monthboucle*4][weekofmonth][day].trim().length()!=0)
&& (Integer
.parseInt(semyear[month
+ monthboucle * 4][weekofmonth][day]
.trim()) == epoch
.get(Calendar.DAY_OF_MONTH)))
System.out.print("<");
else
System.out.print(" ");
}
if (epoch.getFirstDayOfWeek() > 1)
for (int day = 1; day < epoch.getFirstDayOfWeek(); day++) {
System.out.print(semyear[month + monthboucle
* 4][weekofmonth][day]);
if ((annee == epoch.get(Calendar.YEAR))
&& // test to put a "<" after the
// current day
((month + monthboucle * 4) == epoch
.get(Calendar.MONTH))
&& (semyear[month+monthboucle*4][weekofmonth][day].trim().length()!=0)
&& (Integer
.parseInt(semyear[month
+ monthboucle * 4][weekofmonth][day]
.trim()) == epoch
.get(Calendar.DAY_OF_MONTH)))
System.out.print("<");
else
System.out.print(" ");
}
System.out.print(" ");// split to next month on the
// same line
}
System.out.println("");// New line after week printed for 4
// months

}
System.out.println(""); // new line after the "Months line"
// *************************************************************************************
}// endfor
} catch (Exception e) {
e.printStackTrace();
}

}

public static Date stringToDate(String sDate, String sFormat)
throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat(sFormat);
return sdf.parse(sDate);
}

}
PS: Plus d'erreurs a la compil
yvkoe Messages postés 32 Date d'inscription jeudi 20 septembre 2007 Statut Membre Dernière intervention 19 janvier 2009
25 sept. 2007 à 11:26
bonjour,
bravo là pas de blème tout fonctionne bravo encore
dje_jay Messages postés 58 Date d'inscription mercredi 17 décembre 2003 Statut Membre Dernière intervention 16 février 2011 2
24 sept. 2007 à 17:39
Bon ... Ben ok! :-p lol!
"isEmpty" est apparu à partir du JDK 1.6 ...
(Mon JDK par defaut n'est pas celui que je pensais)...
Vous pouvez remplacer "isEmpty" par ".length()!=0" (En effaçant le "!" du début de condition). Ca donne :
...
(semyear[month+monthboucle*4][weekofmonth][day].trim().length()!=0)&&
...
yvkoe Messages postés 32 Date d'inscription jeudi 20 septembre 2007 Statut Membre Dernière intervention 19 janvier 2009
24 sept. 2007 à 14:47
bonjour,
eh oui j'ai JDK 1.5 et eclipse dernière version(mise à jour automatique à l'ouverture)
j'ai fait un copy past ,essaye avec eclipse et copy paste sur la version ci dessus ,crois moi je préfèrerais ne pas avoir d'erreur car je trouve le cal très sympa...
dje_jay Messages postés 58 Date d'inscription mercredi 17 décembre 2003 Statut Membre Dernière intervention 16 février 2011 2
24 sept. 2007 à 14:05
Bonjour,

Merci de vos réactions.
Yvkoe : As-tu récupéré le projet du zip ou c'est le résultat d'un copy/past?
A la ligne 147, j'ai "}", le dernier "isEmpty" est à la ligne 139...
D'autre part, est-ce que tu utilises un JDK récent?
Je ne saurais dire à partir de quand est apparue la méthode isEmpty, mais le JDK1.5 l'a...
----------------------
boolean isEmpty()
Returns true if, and only if, length() is 0.
----------------------
(J'utilise Eclipse 3.2)
yvkoe Messages postés 32 Date d'inscription jeudi 20 septembre 2007 Statut Membre Dernière intervention 19 janvier 2009
22 sept. 2007 à 12:55
bonjour,
voici après compil le message eclipseException in thread "main" java.lang.Error: Problèmes de compilation non résolus :
La méthode isEmpty() est indéfinie pour le type String
La méthode isEmpty() est indéfinie pour le type String

at Cal.main(cal.java:147)
Désole mais la c'est eclipse
Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 111
20 sept. 2007 à 21:02
Salut,

yvkoe > Si ce que tu as mit 2 poste plus haut, c'est ce que tu as mit dans eclipse, regarde vers le bas il y a encore des #
[...]
{
e.printStackTrace();
# }
#
#
# }
#
public static Date stringToDate(String sDate, String sFormat) throws Exception
{
[...]
pour le reste tu as du faire des choses hors sujet avec ton eclipse et le code ....
voici le code sans les # :
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.Vector;

public class Cal {
static String semyear[][][] = new String[13][6][8];

/**
* @param args
*/
public static void main(String[] args) {
int annee = 0;
int dayofweek = 0;
int weekofmonth = 0;
int month = 0;
int index = 0;
Vector vDayNames = new Vector();
Vector vMonthNames = new Vector();
String MonthTitle = "";

Date dt1;
try {
Calendar epoch = GregorianCalendar.getInstance(TimeZone
.getDefault());// TimeZone.getTimeZone("Europe/Paris"));
if (args.length != 0)
annee = Integer.parseInt(args[0]);
else
annee = epoch.get(Calendar.YEAR);

// init table
for (int i = 0; i < 13; i++)
for (int j = 0; j < 6; j++)
for (int k = 0; k < 8; k++)
semyear[i][j][k] = " ";

System.out.println(annee);

// Set epoch to 1st jan of the year
dt1 = stringToDate("01/01/" + annee, "dd/MM/yyyy");
epoch.setTime(dt1);

// fill the vector vDayNames with short names of days of the week
DateFormat dateFormat = new SimpleDateFormat("EEE");
index = 1;// sunday 1st
while (index < 8) {
if (epoch.get(Calendar.DAY_OF_WEEK) == index) {
vDayNames.add(dateFormat.format(epoch.getTime()));
index++;
}
epoch.add(Calendar.DAY_OF_YEAR, 1);// while epoch isn't a
// sunday
}

// re initialize to 1st jan of the year
dt1 = stringToDate("01/01/" + annee, "dd/MM/yyyy");
epoch.setTime(dt1);

// fill the vector vMonthNames with full month names
dateFormat = new SimpleDateFormat("MMMMM");
index = Calendar.JANUARY;
while (index <= Calendar.DECEMBER) {
vMonthNames.add(dateFormat.format(epoch.getTime()));
index++;
epoch.add(Calendar.MONTH, 1);
}

// re initialize to 1st jan of the year
dt1 = stringToDate("01/01/" + annee, "dd/MM/yyyy");
epoch.setTime(dt1);

// fill the table of the current year
while (epoch.get(Calendar.YEAR) == annee) {
dayofweek = epoch.get(Calendar.DAY_OF_WEEK);
weekofmonth = epoch.get(Calendar.WEEK_OF_MONTH);
month = epoch.get(Calendar.MONTH);
if (epoch.get(Calendar.DAY_OF_MONTH) < 10)
semyear[month][weekofmonth][dayofweek] = "0"
+ Integer
.toString(epoch.get(Calendar.DAY_OF_MONTH));
else
semyear[month][weekofmonth][dayofweek] = Integer
.toString(epoch.get(Calendar.DAY_OF_MONTH));
epoch.add(Calendar.DAY_OF_YEAR, 1);
}

// Cycle for Lines of months
for (int monthboucle = 0; monthboucle < 3; monthboucle++) {
epoch = GregorianCalendar.getInstance(TimeZone.getDefault());
// *************************************************************************************
// Print month names
MonthTitle = ((String) vMonthNames.get(0 + monthboucle * 4));
for (int i = MonthTitle.length(); i < 22; i++)
MonthTitle += " ";// up to char pos 22
MonthTitle += ((String) vMonthNames.get(1 + monthboucle * 4));
for (int i = MonthTitle.length(); i < 44; i++)
MonthTitle += " ";// up to char pos 44
MonthTitle += ((String) vMonthNames.get(2 + monthboucle * 4));
for (int i = MonthTitle.length(); i < 66; i++)
MonthTitle += " ";// up to char pos 66
MonthTitle += ((String) vMonthNames.get(3 + monthboucle * 4));
System.out.println(MonthTitle);

// Show days name
for (int i = 0; i < 4; i++) {
for (int j = epoch.getFirstDayOfWeek() - 1; j < 7; j++)
System.out.print(((String) vDayNames.get(j)).substring(
0, 2)
+ " ");
if (epoch.getFirstDayOfWeek() > 1)
for (int j = 0; j < epoch.getFirstDayOfWeek() - 1; j++)
System.out.print(((String) vDayNames.get(j))
.substring(0, 2)
+ " ");
System.out.print(" ");
}
System.out.println("");

// print a line of months
for (weekofmonth = 0; weekofmonth < 6; weekofmonth++)// 6
// lines
// per
// months
{
for (month = 0; month < 4; month++) // 4 months per line
{
for (int day = epoch.getFirstDayOfWeek(); day < 8; day++) // 7
// days
// per
// week
{
System.out
.print(semyear[month + monthboucle * 4][weekofmonth][day]);
if ((annee == epoch.get(Calendar.YEAR))
&& // test to put a "<" after the current
// day
((month + monthboucle * 4) == epoch
.get(Calendar.MONTH))
&& (!semyear[month + monthboucle * 4][weekofmonth][day]
.trim().isEmpty())
&& (Integer
.parseInt(semyear[month
+ monthboucle * 4][weekofmonth][day]
.trim()) == epoch
.get(Calendar.DAY_OF_MONTH)))
System.out.print("<");
else
System.out.print(" ");
}
if (epoch.getFirstDayOfWeek() > 1)
for (int day = 1; day < epoch.getFirstDayOfWeek(); day++) {
System.out.print(semyear[month + monthboucle
* 4][weekofmonth][day]);
if ((annee == epoch.get(Calendar.YEAR))
&& // test to put a "<" after the
// current day
((month + monthboucle * 4) == epoch
.get(Calendar.MONTH))
&& (!semyear[month + monthboucle * 4][weekofmonth][day]
.trim().isEmpty())
&& (Integer
.parseInt(semyear[month
+ monthboucle * 4][weekofmonth][day]
.trim()) == epoch
.get(Calendar.DAY_OF_MONTH)))
System.out.print("<");
else
System.out.print(" ");
}
System.out.print(" ");// split to next month on the
// same line
}
System.out.println("");// New line after week printed for 4
// months

}
System.out.println(""); // new line after the "Months line"
// *************************************************************************************
}// endfor
} catch (Exception e) {
e.printStackTrace();
}

}

public static Date stringToDate(String sDate, String sFormat)
throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat(sFormat);
return sdf.parse(sDate);
}

}
yvkoe Messages postés 32 Date d'inscription jeudi 20 septembre 2007 Statut Membre Dernière intervention 19 janvier 2009
20 sept. 2007 à 14:08
Rebonjour,
soit je ne sais plus faire un copier coller,soit Eclipse a peté un boulo, soit ton package (que j'ai viré puisque je ne l'ai pas) contenait les codes manquants )
mais si c'est sur ton heure de table...tu es pardonné
Beau boulot en si peu de temps
yvkoe Messages postés 32 Date d'inscription jeudi 20 septembre 2007 Statut Membre Dernière intervention 19 janvier 2009
20 sept. 2007 à 14:01
Bonjour,
j'ai mis ton appli dans Eclipse et voila ce que ca donne
t'aurais pas oublié quelques petites choses (isEmpty??,formatDate??)


import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar; import java.util.TimeZone;
import java.util.Vector;

public class Cal
{
static String semyear[][][]=new String [13][6][

public static void main(String[] args)
{
int annee=0;
int dayofweek=0;
int weekofmonth=0;
int month=0; int index=0;
Vector vDayNames=new Vector();
Vector vMonthNames=new Vector();
String MonthTitle="";

Date dt1;
try
{
Calendar epoch = GregorianCalendar.getInstance(TimeZone.getDefault());//TimeZone.getTimeZone("Europe/Paris"));
if (args.length!=0) annee=Integer.parseInt(args[0]);
else annee=epoch.get(Calendar.YEAR);

//init table for(int i=0;i<13;i++)
for (int j=0;j<6;j++)
for (int k=0;k<8;k++) semyear[i][j][k]=" ";

System.out.println(annee);

//Set epoch to 1st jan of the year
dt1 = stringToDate("01/01/"+annee,"dd/MM/yyyy");
epoch.setTime(dt1);

//fill the vector vDayNames with short names of days of the weekDateFormat dateFormat = new SimpleDateFormat("EEE");
index=1;//sunday 1st
while (index<8)
{
if (epoch.get(Calendar.DAY_OF_WEEK)==index)
{
vDayNames.add(DateFormat.format(epoch.getTime()));
index++;
}
epoch.add(Calendar.DAY_OF_YEAR, 1);//while epoch isn't a sunday
}

//re initialize to 1st jan of the year
dt1 = stringToDate("01/01/"+annee,"dd/MM/yyyy");
epoch.setTime(dt1);

//fill the vector vMonthNames with full month names
DateFormat = new SimpleDateFormat("MMMMM");
index=Calendar.JANUARY;
while (index<=Calendar.DECEMBER)
{
vMonthNames.add(DateFormat.format(epoch.getTime()));
index++;
epoch.add(Calendar.MONTH, 1);
}

//re initialize to 1st jan of the year
dt1 = stringToDate("01/01/"+annee,"dd/MM/yyyy");
epoch.setTime(dt1);

//fill the table of the current year
while (epoch.get(Calendar.YEAR)==annee)
{
dayofweek=epoch.get(Calendar.DAY_OF_WEEK);
weekofmonth=epoch.get(Calendar.WEEK_OF_MONTH);
month=epoch.get(Calendar.MONTH);
if (epoch.get(Calendar.DAY_OF_MONTH)<10)
semyear[month][weekofmonth][dayofweek]="0"+Integer.toString(epoch.get(Calendar.DAY_OF_MONTH));
else
semyear[month][weekofmonth][dayofweek]=Integer.toString(epoch.get(Calendar.DAY_OF_MONTH));
epoch.add(Calendar.DAY_OF_YEAR, 1);
}
//Cycle for Lines of months
for (int monthboucle=0;monthboucle<3;monthboucle++)
{
epoch = GregorianCalendar.getInstance(TimeZone.getDefault());
//*************************************************************************************
//Print month names
MonthTitle=((String)vMonthNames.get(0+monthboucle*4));
for(int i=MonthTitle.length();i<22;i++) MonthTitle+=" ";//up to char pos 22
MonthTitle+=((String)vMonthNames.get(1+monthboucle*4));
for(int i=MonthTitle.length();i<44;i++) MonthTitle+=" ";//up to char pos 44
MonthTitle+=((String)vMonthNames.get(2+monthboucle*4));
for(int i=MonthTitle.length();i<66;i++) MonthTitle+=" ";//up to char pos 66
MonthTitle+=((String)vMonthNames.get(3+monthboucle*4));
System.out.println(MonthTitle);

//Show days name
for (int i=0;i<4;i++)
{
for (int j=epoch.getFirstDayOfWeek()-1;j<7;j++)
System.out.print(((String)vDayNames.get(j)).substring(0, 2)+" ");
if (epoch.getFirstDayOfWeek()>1)
for (int j=0;j<epoch.getFirstDayOfWeek()-1;j++)
System.out.print(((String)vDayNames.get(j)).substring(0, 2)+" ");
System.out.print(" ");
}
System.out.println("");

//print a line of months
for (weekofmonth=0;weekofmonth<6;weekofmonth++)//6 lines per months
{
for (month=0;month<4;month++) //4 months per line
{
for (int day=epoch.getFirstDayOfWeek();day<8;day++) //7 days per week
{
System.out.print(semyear[month+monthboucle*4][weekofmonth][day]);
if ((annee==epoch.get(Calendar.YEAR))&& //test to put a "<" after the current day
((month+monthboucle*4)==epoch.get(Calendar.MONTH))&&
(!semyear[month+monthboucle*4][weekofmonth][day].trim().isEmpty())&&
( Integer.parseInt(semyear[month+monthboucle*4][weekofmonth][day].trim())==epoch.get(Calendar.DAY_OF_MONTH)) )
System.out.print("<");
else System.out.print(" ");
}
if (epoch.getFirstDayOfWeek()>1)
for (int day=1;day<epoch.getFirstDayOfWeek();day++)
{
System.out.print(semyear[month+monthboucle*4][weekofmonth][day]);
if ((annee==epoch.get(Calendar.YEAR))&& //test to put a "<" after the current day
((month+monthboucle*4)==epoch.get(Calendar.MONTH))&&
(!semyear[month+monthboucle*4][weekofmonth][day].trim().isEmpty())&&
( Integer.parseInt(semyear[month+monthboucle*4][weekofmonth][day].trim())==epoch.get(Calendar.DAY_OF_MONTH)) )
System.out.print("<"); else System.out.print(" ");
}
System.out.print(" ");//split to next month on the same line
}
System.out.println("");// New line after week printed for 4 months

}
System.out.println(""); //new line after the "Months line"
//*************************************************************************************
}//endfor
} catch (Exception e)
{
e.printStackTrace();
# }
#
#
# }
#
public static Date stringToDate(String sDate, String sFormat) throws Exception
{
SimpleDateFormat sdf = new SimpleDateFormat(sFormat);
return sdf.parse(sDate);
}

}
Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 111
19 sept. 2007 à 20:03
Salut,

je n'ai pas testé, ni regardé le code mais d'après la capture, l'appli me bote bien (même si j'ai déjà cal) ^^.

Si tu veux faire comme cal tu peux regarder du coté de ma source (http://www.javafr.com/codes/ECRIRE-COULEURS-SUR-CONSOLE-JNI_39674.aspx) pour modifier le fond du bon jour ^^

le code tourne sous nux et windoz (normalement mac, mais je n'ai pas de ppc avec un mac os...).
Rejoignez-nous