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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660
| import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.Calendar;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
public class Premfen0 {
/*************************************************************************************************/
/** Cette méthode transforme une chaine de caractère qui représente une heure (exemple 08:00:00)*/
/** en nombre de minutes (exemple 08:00:00 => 480) */
/*************************************************************************************************/
static public int TimeStringtoInt(String temps){
// durée sous forme d'un tableau de chaine : case 0 = heures, case 1 = min, case 2 = sec
String[] Chaine = temps.split(":");
int duree = (new Integer(Chaine[0])).intValue() * 60
+(new Integer(Chaine[1])).intValue();
return duree;
}
/*************************************************************************************************/
/** Cette méthode permet de savoir le jour actuel */
/*************************************************************************************************/
static public String JoursActu(String datejours){
// Les jours de la semaine.
// NOTE: Cet ordre des jours de la semaine est exigé par la
// formule de Zeller
String[] days = { "Samedi", "Dimanche", "Lundi", "Mardi",
"Mercredi", "Jeudi", "Vendredi" };
// Formule de Zeller (Mathématicien Allemand
String datedujour;
datedujour = datejours;
String[] rs = datedujour.split("-");
String annee1, mois1, jour1, jourbon;
annee1 = rs[0];
mois1 = rs[1];
jour1 = rs[2];
int annee2 = Integer.parseInt(annee1);
int mois2 = Integer.parseInt(mois1);
int jour2 = Integer.parseInt(jour1);
System.out.println(annee1);
System.out.println(mois1);
System.out.println(jour1);
if ((mois2 == 1) | (mois2 == 2)) {
mois2 += 12;
annee2--;
}
int cc = annee2 / 100;
int yy = annee2 % 100;
int ki = (int) (jour2 + Math.round(2.6d * (mois2 + 1))
+ Math.round(cc / 4) - 2 * cc + yy + Math.round(yy / 4));
if (ki < 0) {
ki = (-ki) % 7;
ki = 7 - ki;
}
jourbon = days[ki % 7];
return jourbon;
}
public static void main( String[] arg) {
Connection con = null;
Statement EtatdeBD = null;
ResultSet Résultat = null;
ResultSetMetaData RésultatMeta = null;
int colonne;
int j, k = 0;
int po = 0;
int ajout = 0;
int maty = 0, matx = 0;
int i = 0;
int posy=0;
String anneeactuelle = "", anneeactuelle1, moisactuel = "", moisactuel1, jouractuel = "", jouractuel1, datedebutsem = "", datefinsem = "";
// Savoir quel jour on est, et savoir la date du début de semaine et de
// fin.
Calendar c = Calendar.getInstance();
Timestamp dateactuelle = new Timestamp(c.getTimeInMillis());
if (c.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
String[] tableaudateactuelle = dateactuelle.toString().split(
"-");
anneeactuelle = tableaudateactuelle[0];
moisactuel = tableaudateactuelle[1];
jouractuel = tableaudateactuelle[2].substring(0, 3);
datedebutsem = anneeactuelle + moisactuel + jouractuel;
System.out.println(datedebutsem);
c.add(java.util.Calendar.DATE, (+6));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle1 = dateactuelle.toString()
.split("-");
anneeactuelle1 = tableaudateactuelle1[0];
moisactuel1 = tableaudateactuelle1[1];
jouractuel1 = tableaudateactuelle1[2].substring(0, 3);
datefinsem = anneeactuelle1 + moisactuel1 + jouractuel1;
System.out.println(datefinsem);
c.add(java.util.Calendar.DATE, (-6));
}
if (c.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY) {
c.add(java.util.Calendar.DATE, (-1));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle = dateactuelle.toString().split(
"-");
anneeactuelle = tableaudateactuelle[0];
moisactuel = tableaudateactuelle[1];
jouractuel = tableaudateactuelle[2].substring(0, 3);
datedebutsem = anneeactuelle + moisactuel + jouractuel;
System.out.println(datedebutsem);
c.add(java.util.Calendar.DATE, (+6));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle1 = dateactuelle.toString()
.split("-");
anneeactuelle1 = tableaudateactuelle1[0];
moisactuel1 = tableaudateactuelle1[1];
jouractuel1 = tableaudateactuelle1[2].substring(0, 3);
datefinsem = anneeactuelle1 + moisactuel1 + jouractuel1;
System.out.println(datefinsem);
c.add(java.util.Calendar.DATE, (-5));
}
if (c.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) {
c.add(java.util.Calendar.DATE, (-2));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle = dateactuelle.toString().split(
"-");
anneeactuelle = tableaudateactuelle[0];
moisactuel = tableaudateactuelle[1];
jouractuel = tableaudateactuelle[2].substring(0, 3);
datedebutsem = anneeactuelle + moisactuel + jouractuel;
System.out.println(datedebutsem);
c.add(java.util.Calendar.DATE, (+6));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle1 = dateactuelle.toString()
.split("-");
anneeactuelle1 = tableaudateactuelle1[0];
moisactuel1 = tableaudateactuelle1[1];
jouractuel1 = tableaudateactuelle1[2].substring(0, 3);
datefinsem = anneeactuelle1 + moisactuel1 + jouractuel1;
System.out.println(datefinsem);
c.add(java.util.Calendar.DATE, (-4));
}
if (c.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) {
c.add(java.util.Calendar.DATE, (-3));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle = dateactuelle.toString().split(
"-");
anneeactuelle = tableaudateactuelle[0];
moisactuel = tableaudateactuelle[1];
jouractuel = tableaudateactuelle[2].substring(0, 3);
datedebutsem = anneeactuelle + moisactuel + jouractuel;
System.out.println(datedebutsem);
c.add(java.util.Calendar.DATE, (+6));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle1 = dateactuelle.toString()
.split("-");
anneeactuelle1 = tableaudateactuelle1[0];
moisactuel1 = tableaudateactuelle1[1];
jouractuel1 = tableaudateactuelle1[2].substring(0, 3);
datefinsem = anneeactuelle1 + moisactuel1 + jouractuel1;
System.out.println(datefinsem);
c.add(java.util.Calendar.DATE, (-3));
}
if (c.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) {
c.add(java.util.Calendar.DATE, (-4));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle = dateactuelle.toString().split(
"-");
anneeactuelle = tableaudateactuelle[0];
moisactuel = tableaudateactuelle[1];
jouractuel = tableaudateactuelle[2].substring(0, 3);
datedebutsem = anneeactuelle + moisactuel + jouractuel;
System.out.println(datedebutsem);
c.add(java.util.Calendar.DATE, (+6));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle1 = dateactuelle.toString()
.split("-");
anneeactuelle1 = tableaudateactuelle1[0];
moisactuel1 = tableaudateactuelle1[1];
jouractuel1 = tableaudateactuelle1[2].substring(0, 3);
datefinsem = anneeactuelle1 + moisactuel1 + jouractuel1;
System.out.println(datefinsem);
c.add(java.util.Calendar.DATE, (-2));
}
if (c.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
c.add(java.util.Calendar.DATE, (-5));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle = dateactuelle.toString().split(
"-");
anneeactuelle = tableaudateactuelle[0];
moisactuel = tableaudateactuelle[1];
jouractuel = tableaudateactuelle[2].substring(0, 3);
datedebutsem = anneeactuelle + moisactuel + jouractuel;
System.out.println(datedebutsem);
c.add(java.util.Calendar.DATE, (+6));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle1 = dateactuelle.toString()
.split("-");
anneeactuelle1 = tableaudateactuelle1[0];
moisactuel1 = tableaudateactuelle1[1];
jouractuel1 = tableaudateactuelle1[2].substring(0, 3);
datefinsem = anneeactuelle1 + moisactuel1 + jouractuel1;
System.out.println(datefinsem);
c.add(java.util.Calendar.DATE, (-1));
}
if (c.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
String[] tableaudateactuelle1 = dateactuelle.toString()
.split("-");
anneeactuelle1 = tableaudateactuelle1[0];
moisactuel1 = tableaudateactuelle1[1];
jouractuel1 = tableaudateactuelle1[2].substring(0, 3);
datefinsem = anneeactuelle1 + moisactuel1 + jouractuel1;
System.out.println(datefinsem);
c.add(java.util.Calendar.DATE, (-6));
dateactuelle = new java.sql.Timestamp(c.getTimeInMillis());
String[] tableaudateactuelle = dateactuelle.toString().split(
"-");
anneeactuelle = tableaudateactuelle[0];
moisactuel = tableaudateactuelle[1];
jouractuel = tableaudateactuelle[2].substring(0, 3);
datedebutsem = anneeactuelle + moisactuel + jouractuel;
System.out.println(datedebutsem);
}
String queryString = "SELECT ue,ref_mat,nom_mat,type_mat,cat_mat,nom_gr,niv,dep,nom_prof,id_et,id_prof_sec,prenom,et_type,et_ens,et_status,et_date,et_debut,et_duree,nom_salle,emptps.id_gr,color_co,color_ct,color_td,color_dp,color_tp,divers,video,ens_def FROM emptps,salle,matiere,prof,groupe WHERE emptps.id_form =6 AND emptps.id_gr=groupe.id_gr AND emptps.id_salle=salle.id_salle AND emptps.id_mat=matiere.id_mat AND et_date>="
+ datedebutsem
+ " AND et_date<="
+ datefinsem
+ " ORDER BY et_date,ue,nom_mat,nom_gr,nom_salle,et_debut,et_duree";
try {
/** Etape 1: charger le pilote */
Class.forName("com.mysql.jdbc.Driver");
/** Etape 2: Etablissement de la connexion à la base de données */
con = DriverManager.getConnection("jdbc:mysql://localhost/GEII",
"root", "");
JOptionPane.showMessageDialog(null, "Connection OK");
/** Etape 3: produire le Statement */
EtatdeBD = con.createStatement();
/** Etape 4: Executer la requête */
Résultat = EtatdeBD.executeQuery(queryString);
RésultatMeta = Résultat.getMetaData();
colonne = RésultatMeta.getColumnCount();
JFrame frame = new JFrame("Simple Frame Essai");
int width = 1280; // Largeur de la fenetre
int height = 1024; // Hauteur de la fenetre
/* dimension de la fenetre */
frame.setSize(width, height);
frame.setLayout(null);
String taille = "";
int ht = 0;
int la = 0;
int positionjours = 0, positionjourslundi = 0, positionjoursmardi = 0, positionjoursmercredi = 0, positionjoursjeudi = 0, positionjoursvendredi = 0, positionjourssamedi = 0, limitetab, hauteurdujour = 0, hauteurdujour1 = 0, hauteurdujour2 = 0, hauteurdujour3 = 0, hauteurdujour4 = 0, hauteurdujour5 = 0, hauteurdujour6 = 0;
// Tableau pour savoir s'il y a deja un cour ou pas
int[][] matrice = new int[18][22];
for (j = 0; j < 18; j++) {
for (k = 0; k < 22; k++) {
matrice[j][k] = 0;
}
}
/** Etape 5: utilisation du résultat */
while (Résultat.next()) {
int tailleecriture = 3;
/******************************************************************************************/
/** jours actuel */
/******************************************************************************************/
String jourbon = JoursActu (Résultat.getString("et_date"));
/******************************************************************************************/
/** durée sous forme d'un tableau de chaine : case 0 = heures, case 1 = min, case 2 = sec */
/******************************************************************************************/
// Savoir combien de temps dure un cours pour pouvoir avoir sa largueur
int duree = TimeStringtoInt(Résultat.getString("et_duree"));
limitetab = duree /30;
la = (limitetab *49)+6; // +6 car il faut compter les bordures.
taille = "width="+la+" ";
/******************************************************************************************/
/** durée sous forme d'un tableau de chaine : case 0 = heures, case 1 = min, case 2 = sec */
/******************************************************************************************/
// Savoir où positionner le cours suivant l'heure
duree = TimeStringtoInt(Résultat.getString("et_debut"));
int coef = duree - 480; //coef = 0 pour 8h
ht = ((coef/30)*49)+126;
/******************************************************************************************/
/** Permet de remplir la matrice */
/******************************************************************************************/
// Savoir quel type de cours pour la couleur.
String couleurdefond = "";
if (Résultat.getString("ens_def").equals("")) {
couleurdefond = Résultat.getString("color_co");
System.out.println(couleurdefond);
} else {
if (Résultat.getString("ens_def").equals("TP")) {
couleurdefond = Résultat.getString("color_tp");
System.out.println(couleurdefond);
} else {
if (Résultat.getString("ens_def").equals("TD")) {
couleurdefond = Résultat.getString("color_td");
System.out.println(couleurdefond);
} else {
if (Résultat.getString("ens_def").equals("Co")) {
couleurdefond = Résultat.getString("color_co");
System.out.println(couleurdefond);
}
}
}
}
JLabel epts = new JLabel("<html><table border=2 BGCOLOR="
+ couleurdefond + "><td align='center' " + taille
+ "><FONT SIZE=" + tailleecriture + ">"
+ Résultat.getString("ue")
+ " - <font color='#000099'>"
+ Résultat.getString("nom_mat") + "</font>"
+ " <font color='red'>" + Résultat.getString("divers")
+ "</font>" + "<br><font color='#CC3399'>"
+ Résultat.getString("nom_gr") + "</font>" + " "
+ Résultat.getString("nom_salle")
+ "<br><font color='red'>"
+ Résultat.getString("et_debut").substring(0, 5)
+ "</font>" + " - " + "<font color='red'>"
+ Résultat.getString("et_duree").substring(0, 5)
+ "</font>" + "<br>" + Résultat.getString("nom_prof")
+ "</FONT></td></table></html>");
frame.add(epts);
if (jourbon == "Lundi") {
posy=0;
while (matrice[posy][coef/30]!=0){
posy++;
}
i=0;
while (limitetab!=0){
matrice [posy][(coef/30)+i]=1;
i++;
limitetab--;
}
positionjourslundi = 148;
epts.setBounds(ht, positionjourslundi, la, 80);
} else if (jourbon == "Mardi") {
posy=3;
while (matrice[posy][coef/30]!=0){
posy++;
}
i=0;
while (limitetab!=0){
matrice [posy][(coef/30)+i]=1;
i++;
limitetab--;
}
positionjoursmardi = 256;
epts.setBounds(ht, positionjoursmardi, la, 80);
} else if (jourbon == "Mercredi") {
posy=6;
while (matrice[posy][coef/30]!=0){
posy++;
}
i=0;
while (limitetab!=0){
matrice [posy][(coef/30)+i]=1;
i++;
limitetab--;
}
positionjoursmercredi = 364;
epts.setBounds(ht, positionjoursmercredi, la, 80);
} else if (jourbon == "Jeudi") {
posy=9;
while (matrice[posy][coef/30]!=0){
posy++;
}
i=0;
while (limitetab!=0){
matrice [posy][(coef/30)+i]=1;
i++;
limitetab--;
}
positionjoursjeudi = 472;
epts.setBounds(ht, positionjoursjeudi, la, 80);
} else if (jourbon == "Vendredi") {
posy=12;
while (matrice[posy][coef/30]!=0){
posy++;
}
i=0;
while (limitetab!=0){
matrice [posy][(coef/30)+i]=1;
i++;
limitetab--;
}
positionjoursvendredi = 580;
epts.setBounds(ht, positionjoursvendredi, la, 80);
}else if (jourbon == "Samedi") {
posy=15;
while (matrice[posy][coef/30]!=0){
posy++;
}
i=0;
while (limitetab!=0){
matrice [posy][(coef/30)+i]=1;
i++;
limitetab--;
}
positionjourssamedi = 688;
epts.setBounds(ht, positionjourssamedi, la, 80);
}
}
// Les jours de la semaine
JLabel Lundi = new JLabel(
"<html><table border=2><td align='center' width=130 height="
+ 78
+ "><font BGCOLOR= color='#CC3399'>Lundi</font></td></table></html>");
JLabel Mardi = new JLabel(
"<html><table border=2><td align='center' width=130 height="
+ 78 + ">Mardi</td></table></html>");
JLabel Mercredi = new JLabel(
"<html><table border=2><td align='center' width=130 height="
+ 78 + ">Mercredi</td></table></html>");
JLabel Jeudi = new JLabel(
"<html><table border=2><td align='center' width=130 height="
+ 78 + ">Jeudi</td></table></html>");
JLabel Vendredi = new JLabel(
"<html><table border=2><td align='center' width=130 height="
+ 78 + ">Vendredi</td></table></html>");
JLabel Samedi = new JLabel(
"<html><table border=2><td align='center' width=130 height="
+ 78 + ">Samedi</td></table></html>");
frame.add(Lundi);
frame.add(Mardi);
frame.add(Mercredi);
frame.add(Jeudi);
frame.add(Vendredi);
frame.add(Samedi);
Lundi.setBounds(0, 150, 130, 78);
Mardi.setBounds(0, 258, 130, 78);
Mercredi.setBounds(0, 366, 130, 78);
Jeudi.setBounds(0, 474, 130,78);
Vendredi.setBounds(0, 582, 130, 78);
Samedi.setBounds(0, 690, 130, 78);
// Les heures
JLabel Huit = new JLabel(
"<html><table border=2><td width=55>8H</td></table></html>");
JLabel Huit2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Neuf = new JLabel(
"<html><table border=2><td width=55>9H</td></table></html>");
JLabel Neuf2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Dix = new JLabel(
"<html><table border=2><td width=55>10H</td></table></html>");
JLabel Dix2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Onze = new JLabel(
"<html><table border=2><td width=55>11H</td></table></html>");
JLabel Onze2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Douze = new JLabel(
"<html><table border=2><td width=55>12H</td></table></html>");
JLabel Douze2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Treize = new JLabel(
"<html><table border=2><td width=55>13H</td></table></html>");
JLabel Treize2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Quatorze = new JLabel(
"<html><table border=2><td width=55>14H</td></table></html>");
JLabel Quatorze2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Quinze = new JLabel(
"<html><table border=2><td width=55>15H</td></table></html>");
JLabel Quinze2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Seize = new JLabel(
"<html><table border=2><td width=55>16H</td></table></html>");
JLabel Seize2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Dixsept = new JLabel(
"<html><table border=2><td width=55>17H</td></table></html>");
JLabel Dixsept2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Dixhuit = new JLabel(
"<html><table border=2><td width=55>18H</td></table></html>");
JLabel Dixhuit2 = new JLabel(
"<html><table border=2><td width=55>30</td></table></html>");
JLabel Dixneuf = new JLabel(
"<html><table border=2><td width=55>19H</td></table></html>");
Huit.setBounds(126, 120, 55, 30);
Huit2.setBounds(175, 120, 55, 30);
Neuf.setBounds(224, 120 , 55, 30);
Neuf2.setBounds(273, 120 , 55, 30);
Dix.setBounds(322, 120 , 55, 30);
Dix2.setBounds(371, 120 , 55, 30);
Onze.setBounds(420, 120 , 55, 30);
Onze2.setBounds(469, 120 , 55, 30);
Douze.setBounds(518, 120 , 55, 30);
Douze2.setBounds(567, 120 , 55, 30);
Treize.setBounds(616, 120 , 55, 30);
Treize2.setBounds(665, 120 , 55, 30);
Quatorze.setBounds(714, 120 , 55, 30);
Quatorze2.setBounds(763, 120 , 55, 30);
Quinze.setBounds(812, 120 , 55, 30);
Quinze2.setBounds(861, 120 , 55, 30);
Seize.setBounds(910, 120 , 55, 30);
Seize2.setBounds(959, 120 , 55, 30);
Dixsept.setBounds(1008, 120 , 55, 30);
Dixsept2.setBounds(1057, 120 , 55, 30);
Dixhuit.setBounds(1106, 120 , 55, 30);
Dixhuit2.setBounds(1155, 120 , 55, 30);
Dixneuf.setBounds(1204, 120 , 55, 30);
frame.add(Huit);
frame.add(Huit2);
frame.add(Neuf);
frame.add(Neuf2);
frame.add(Dix);
frame.add(Dix2);
frame.add(Onze);
frame.add(Onze2);
frame.add(Douze);
frame.add(Douze2);
frame.add(Treize);
frame.add(Treize2);
frame.add(Quatorze);
frame.add(Quatorze2);
frame.add(Quinze);
frame.add(Quinze2);
frame.add(Seize);
frame.add(Seize2);
frame.add(Dixsept);
frame.add(Dixsept2);
frame.add(Dixhuit);
frame.add(Dixhuit2);
frame.add(Dixneuf);
int lili, lala = 0;
for (lala = 0; lala < 18; lala++) {
for (lili = 0; lili < 22; lili++) {
System.out.print(matrice[lala][lili]);
}
System.out.println("");
}
// Date de semaine
JLabel Datelundi = new JLabel(
"<html><table border=2><td align='center' width=130 >"
+ jouractuel + "-" + moisactuel + "-"
+ anneeactuelle + "</td></table></html>");
Datelundi.setBounds(0, 96, 130, 78);
frame.add(Datelundi);
// Action a faire lorsque la fenetre est fermee par
// l'utilisateur. D'autres actions possibles :
// - JFrame.DO_NOTHING_ON_CLOSE
// - JFrame.DISPOSE_ON_CLOSE
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Affichage de la fenetre
frame.setVisible(true);
} catch ( ClassNotFoundException ex) {
JOptionPane.showMessageDialog(null, "Class not found!\n"
+ ex.getMessage());
} catch ( SQLException ex) {
JOptionPane.showMessageDialog(null, "JDBC Erreur:\n"
+ ex.getMessage());
} finally {
/** Etape 6: Libérer les ressources non utilisée */
try {
if (Résultat != null) {
Résultat.close();
}
if (EtatdeBD != null) {
EtatdeBD.close();
}
if (con != null) {
con.close();
}
} catch ( SQLException ex) {
ex.printStackTrace();
}
}
}
} |
Partager