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
| public class PagePrincipale extends javax.swing.JFrame {
Color couleur;
Activites[] monuments;
Activites[] piscines;
Activites[] zoos;
Activites[] musees;
Activites[] restos;
Activites[] parcours;
Activites[] monumentsouvert;
Activites[] piscinesouvert;
Activites[] zoosouvert;
Activites[] museesouvert;
Activites[] restosouvert;
Activites[] parcoursouvert;
Activites[] frise;
Ville newyork;
int jour;
int nbmon;
int nbmus;
int nbpisc;
int nbzoo;
int nbresto;
int nbparcours;
int nbact;
int choix=0;
public PagePrincipale() {
initComponents();
calendrier diag=new calendrier(this,true);
diag.setVisible(true);
jour=diag.getJour();
frise=new Activites[10];
monuments=new Activites[10];
piscines=new Activites[10];
zoos=new Activites[10];
musees=new Activites[10];
restos=new Activites[10];
parcours=new Activites[10];
piscinesouvert=new Activites[10];
zoosouvert=new Activites[10];
museesouvert=new Activites[10];
restosouvert=new Activites[10];
parcoursouvert=new Activites[10];
monumentsouvert=new Activites[10];
newyork=new Ville(1500,10,"NY");
nbmon=0;
nbmus=0;
nbpisc=0;
nbzoo=0;
nbresto=0;
nbparcours=0;
nbact=0;
Monument m;
m=new Monument(false,2.0);
m.setjOuv(true,false,true,false,true,false,true);
m.setinformations("Tour eiffel",10,8.26,11.53);
m.VisiteGuidee(true,8.00,20,8.00,10.00,"Visite Guidee de la tour");
newyork.ajourActivités(m);
monuments[0]=m;
nbmon++;
Zoo zoo=new Zoo(false,1200,30000,3.0);
zoo.setjOuv(true,true,true,false,true,true,true);
zoo.setinformations("zoo",10,8.00,23.00);
newyork.ajourActivités(zoo);
zoos[0]=zoo;
nbzoo++;
Zoo zoo2=new Zoo(false,1400,50000,3.0);
zoo2.setjOuv(true,true,true,false,true,true,true);
zoo2.setinformations("zoo2",10,8.00,23.00);
newyork.ajourActivités(zoo);
zoos[1]=zoo2;
nbzoo++;
Musee mus=new Musee(false,10,3.0);
mus.setinformations("musée",5,8.10,22.00);
mus.setOeuvre("Cheval","Giovanni",1200);
mus.setjOuv(true,true,true,false,true,true,false);
newyork.ajourActivités(mus);
musees[0]=mus;
nbmus++;
Parcours parc=new Parcours(false,5,2.0);
parc.setinformations("ballade",0,8.15,10.00);
parc.AjoutEtape("Etang");
parc.AjoutEtape("Colline");
parc.AjoutEtape("chateau");
parc.VisiteGuidee(true,15.00,20,8.00,9.00,"Visite Guidee du parc");
parc.setjOuv(true,true,true,false,true,true,false);
newyork.ajourActivités(parc);
parcours[0]=parc;
nbparcours=1;
Restaurant resto=new Restaurant(false,5,1.0);
resto.setinformations("Le Resto",0,8.00,20.00);
resto.AjoutMenu("Salades aux amandes",10);
resto.AjoutMenu("Pizza",15);
resto.AjoutMenu("Tarte",5);
resto.setjOuv(false, true, true, true, true, true, true);
newyork.ajourActivités(resto);
restos[0]=resto;
nbresto++;
Piscine pisc=new Piscine(false,150,30,2.0);
pisc.setinformations("Piscine municipale",2.3,8,16);
pisc.setjOuv(false, true, true, true, true, true, true);
newyork.ajourActivités(pisc);
piscines[0]=pisc;
nbpisc++;
actouv(jour);
}
public void setfrise(Activites act){
frise[nbact++]=act;
}
public Activites[] getFrise(){
return frise;
}
/* public void dessineFrise(JComponent jc,Color couleur,int n){
Graphics g=jc.getGraphics();
g.setColor(couleur);
if(frise[n].getduree()==1.0)
{g.drawRect(0,0,40,20);g.fillRect(0,0,40,20);
g.setColor(Color.red);g.drawRect(0, 20, 40, 5);
g.fillRect(0, 20, 40, 5);
}
if(frise[n].getduree()==2.0)
{g.drawRect(0,0,40,40);g.fillRect(0,0,40,40);
g.setColor(Color.red);g.drawRect(0, 40, 40, 5);
g.fillRect(0,40, 40, 5); }
}
public void paint(Graphics g){
super.paint(g);
if(frise[0]!=null)
dessineFrise(Frise,Color.BLUE,0);
}
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jPanel4 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jPanel6 = new javax.swing.JPanel();
mo = new javax.swing.JButton();
pa = new javax.swing.JButton();
mu = new javax.swing.JButton();
pi = new javax.swing.JButton();
zo = new javax.swing.JButton();
res = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jPanel8 = new javax.swing.JPanel();
Frise = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jPanel9 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
AjoutAct = new javax.swing.JMenuItem();
Quitter = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(204, 153, 0));
jPanel3.setLayout(new java.awt.GridLayout(1, 6));
jLabel5.setText(" Durée des Activités :");
jPanel3.add(jLabel5);
jPanel3.add(jTextField1);
jLabel4.setText(" Coût des Activités :");
jPanel3.add(jLabel4);
jPanel3.add(jTextField2);
jLabel6.setText(" Coût du restaurant :");
jPanel3.add(jLabel6);
jPanel3.add(jTextField3);
getContentPane().add(jPanel3, java.awt.BorderLayout.PAGE_END);
jPanel4.setLayout(new java.awt.GridLayout(1, 0));
jPanel1.setLayout(new java.awt.BorderLayout());
jLabel1.setText("Choisissez une Activité en cliquant sur un bouton");
jPanel5.add(jLabel1);
jPanel1.add(jPanel5, java.awt.BorderLayout.NORTH);
jPanel6.setLayout(new java.awt.GridLayout(3, 2));
mo.setText("Monuments");
mo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
moActionPerformed(evt);
}
});
jPanel6.add(mo);
pa.setText("Parcours");
pa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
paActionPerformed(evt);
}
});
jPanel6.add(pa);
mu.setText("Musees");
mu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
muActionPerformed(evt);
}
});
jPanel6.add(mu);
pi.setText("Piscines");
pi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
piActionPerformed(evt);
}
});
jPanel6.add(pi);
zo.setText("Zoo");
zo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
zoActionPerformed(evt);
}
});
jPanel6.add(zo);
res.setText("Restaurants");
res.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
resActionPerformed(evt);
}
});
jPanel6.add(res);
jPanel1.add(jPanel6, java.awt.BorderLayout.CENTER);
jPanel4.add(jPanel1);
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel8.setLayout(new java.awt.GridLayout(1, 0));
javax.swing.GroupLayout FriseLayout = new javax.swing.GroupLayout(Frise);
Frise.setLayout(FriseLayout);
FriseLayout.setHorizontalGroup(
FriseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 208, Short.MAX_VALUE)
);
FriseLayout.setVerticalGroup(
FriseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 269, Short.MAX_VALUE)
);
jPanel8.add(Frise);
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
jPanel8.add(jScrollPane1);
jPanel2.add(jPanel8, java.awt.BorderLayout.CENTER);
jPanel9.setLayout(new java.awt.GridLayout(1, 2));
jLabel2.setText("Frise ");
jPanel9.add(jLabel2);
jLabel3.setText("Information");
jPanel9.add(jLabel3);
jPanel2.add(jPanel9, java.awt.BorderLayout.NORTH);
jPanel4.add(jPanel2);
getContentPane().add(jPanel4, java.awt.BorderLayout.CENTER);
jMenu1.setText("Fichier");
AjoutAct.setText("Ajouter une Activité (au programme)");
jMenu1.add(AjoutAct);
Quitter.setText("Quitter");
jMenu1.add(Quitter);
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>
private void moActionPerformed(java.awt.event.ActionEvent evt) {
Actinfo diag;
diag=new Actinfo(this,true,monumentsouvert,nbmon,frise,choix);
diag.setVisible(true);
if(diag.getchoix()!=null)
frise[choix++]=diag.getchoix();
}
private void paActionPerformed(java.awt.event.ActionEvent evt) {
Actinfo diag;
diag=new Actinfo(this,true,parcoursouvert,nbparcours,frise,choix);
diag.setVisible(true);
if(diag.getchoix()!=null)
frise[choix++]=diag.getchoix();
// Graphics g;
// repaint();
}
private void muActionPerformed(java.awt.event.ActionEvent evt) {
Actinfo diag;
diag=new Actinfo(this,true,museesouvert,nbmus,frise,choix);
diag.setVisible(true);
if(diag.getchoix()!=null)
frise[choix++]=diag.getchoix();
}
private void piActionPerformed(java.awt.event.ActionEvent evt) {
Actinfo diag;
diag=new Actinfo(this,true,piscinesouvert,nbpisc,frise,choix);
diag.setVisible(true);
if(diag.getchoix()!=null)
frise[choix++]=diag.getchoix();
}
private void zoActionPerformed(java.awt.event.ActionEvent evt) {
Actinfo diag;
diag=new Actinfo(this,true,zoosouvert,nbzoo,frise,choix);
diag.setVisible(true);
if(diag.getchoix()!=null)
frise[choix++]=diag.getchoix();
}
private void resActionPerformed(java.awt.event.ActionEvent evt) {
Actinfo diag;
diag=new Actinfo(this,true,restosouvert,nbresto,frise,choix);
diag.setVisible(true);
if(diag.getchoix()!=null)
frise[choix++]=diag.getchoix();
}
public void actouv(int jour){
int k=0;int l=0;int m=0;int o=0;int p=0; int q=0;
for(int i=0;i<nbmon;i++)
if(monuments[i].getjOuv().getOuv(jour))
monumentsouvert[k++]=monuments[i];
for(int i=0;i<nbzoo;i++)
if(zoos[i].getjOuv().getOuv(jour))
zoosouvert[l++]=zoos[i];
for(int i=0;i<nbparcours;i++)
if(parcours[i].getjOuv().getOuv(jour))
parcoursouvert[m++]=parcours[i];
for(int i=0;i<nbmus;i++)
if(musees[i].getjOuv().getOuv(jour))
museesouvert[o++]=musees[i];
for(int i=0;i<nbpisc;i++)
if(piscines[i].getjOuv().getOuv(jour))
piscinesouvert[p++]=piscines[i];
for(int i=0;i<nbresto;i++)
if(restos[i].getjOuv().getOuv(jour))
{restosouvert[q]=restos[i];q++;}
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PagePrincipale().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JMenuItem AjoutAct;
private javax.swing.JPanel Frise;
private javax.swing.JMenuItem Quitter;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JButton mo;
private javax.swing.JButton mu;
private javax.swing.JButton pa;
private javax.swing.JButton pi;
private javax.swing.JButton res;
private javax.swing.JButton zo;
// End of variables declaration
} |
Partager