[text] paul

Viewer

  1. private void afficherParcours(){
  2.                 int largeur= TabLabel[0][0].getWidth();
  3.                 int hauteur= TabLabel[0][0].getHeight();
  4.                 
  5.                 
  6.                  Image im= iconDepart.getImage();
  7.                 im=im.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  8.                 iconDepart=new ImageIcon(im);
  9.                 
  10.                 Image ima= iconAriveer.getImage();
  11.                 ima=ima.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  12.                 iconAriveer=new ImageIcon(ima);
  13.                 
  14.                 Image imag= iconManger.getImage();
  15.                 imag=imag.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  16.                 iconManger=new ImageIcon(imag);
  17.                 
  18.                 Image image= iconDormir.getImage();
  19.                 image=image.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  20.                 iconDormir=new ImageIcon(image);
  21.                 
  22.                 Image images= IconJouer.getImage();
  23.                 images=images.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  24.                 IconJouer=new ImageIcon(images);
  25.                 
  26.                 Image imagess= iconPoison.getImage();
  27.                 imagess=imagess.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  28.                 iconPoison=new ImageIcon(imagess);
  29.                 
  30.                 Image imagesse= iconPiege.getImage();
  31.                 imagesse =imagesse.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  32.                 iconPiege=new ImageIcon(imagesse);
  33.                 
  34.                 Image imagesses= Icon2.getImage();
  35.                 imagesses =imagesses.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  36.                 Icon2=new ImageIcon(imagesses);
  37.                 
  38.                 
  39.                 Image imagessese= Icon4.getImage();
  40.                 imagessese =imagessese.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  41.                 Icon4=new ImageIcon(imagessese);
  42.                 
  43.                 Image imagesse2= IconNombre7.getImage();
  44.                 imagesse2 =imagesse2.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  45.                 IconNombre7=new ImageIcon(imagesse2);
  46.                 
  47.                 Image imagesse3= IconNombre8.getImage();
  48.                 imagesse3 =imagesse3.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  49.                 IconNombre8=new ImageIcon(imagesse3);
  50.                 
  51.                 
  52.                 
  53.                 Image p1= IconIanMalcolm.getImage();
  54.                 p1 =p1.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  55.                 IconIanMalcolm=new ImageIcon(p1);
  56.                 
  57.                 Image p2= IconGrant.getImage();
  58.                 p2 =p2.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  59.                 TabLabel[3][6].setIcon(iconAnimal1);
  60.                 IconGrant=new ImageIcon(p2);
  61.                 
  62.                 
  63.                 
  64.                 Image p3= IconOwen.getImage();
  65.                 p3 =p3.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  66.                 IconOwen=new ImageIcon(p3);
  67.                 
  68.                  Image p4= IconRexy.getImage();
  69.                 p4 =p4.getScaledInstance(largeur,hauteur,Image.SCALE_DEFAULT);
  70.                 IconRexy=new ImageIcon(p4);
  71.                 
  72.                 
  73.                 
  74.                 
  75.                 
  76.                 
  77.                 
  78.                 
  79.                 
  80.              
  81.                 
  82.                 for(int i=0;i<parcours.length;i++){
  83.                     int x=0,y=0;
  84.                     
  85.                     
  86.                       
  87.             if (i<=5){
  88.                 x=0;
  89.                 y=i+5;
  90.             }
  91.             else if (i<16){
  92.                 x=i-5;
  93.                 y=10;
  94.             }
  95.             else if (i<26){
  96.                 x=10;
  97.                 y=25-i;
  98.             }
  99.             else if (i<36){
  100.                 x=35-i;
  101.                 y=0;
  102.             }
  103.             else if (i<40){
  104.                 x=0;
  105.                 y=i-35;
  106.             }
  107.             else if (i==40){
  108.                 x=1;
  109.                 y=5;
  110.             }
  111.             else if (i==44){
  112.                 x=2;
  113.                 y=5;
  114.             }
  115.             else if (i==48){
  116.                 x=3;
  117.                 y=5;
  118.             }
  119.             else if (i==52){
  120.                 x=4;
  121.                 y=5;
  122.             }
  123.             else if (i==56){
  124.                 x=5;
  125.                 y=5;
  126.             }
  127.             else if (i==41){
  128.                 x=5;
  129.                 y=9;
  130.             }else if (i==45){
  131.                 x=5;
  132.                 y=8;
  133.             }
  134.             else if (i==49){
  135.                 x=5;
  136.                 y=7;
  137.             }
  138.             else if (i==53){
  139.                 x=5;
  140.                 y=6;  
  141.             }
  142.               else if (i==42){
  143.                 x=9;
  144.                 y=5;
  145.             }else if (i==46){
  146.                 x=8;
  147.                 y=5;
  148.             }
  149.             else if (i==50){
  150.                 x=7;
  151.                 y=5;
  152.             }
  153.             else if (i==54){
  154.                 x=6;
  155.                 y=5;  
  156.             }  else if (i==43){
  157.                 x=5;
  158.                 y=1;
  159.             }else if (i==47){
  160.                 x=5;
  161.                 y=2;
  162.             }
  163.             else if (i==51){
  164.                 x=5;
  165.                 y=3;
  166.             }
  167.             else if (i==55){
  168.                 x=5;
  169.                 y=4;  
  170.             }
  171.                     
  172.                      
  173.                     
  174.                    
  175.                     
  176.                     switch (parcours[i]){
  177.                          case 1 : TabLabel[x][y].setIcon(iconDepart);
  178.                             break;
  179.                           case 2 : TabLabel[x][y].setIcon(iconAriveer);
  180.                             break;
  181.                             case 3 : TabLabel[x][y].setIcon(iconManger);
  182.                             break;
  183.                              case 4 : TabLabel[x][y].setIcon(iconDormir);
  184.                             break;
  185.                             case 5 : TabLabel[x][y].setIcon(IconJouer);
  186.                             break;
  187.                             case 6 : TabLabel[x][y].setIcon(iconPoison);
  188.                             break;
  189.                             case 7 : TabLabel[x][y].setIcon(iconPiege);
  190.                             break;
  191.                           }
  192.                     
  193.                     
  194.             if (pos1<=5){
  195.                 x=0;
  196.                 y=pos1+5;
  197.             }
  198.             else if (pos1<16){
  199.                 x=pos1-5;
  200.                 y=10;
  201.             }
  202.             else if (pos1<26){
  203.                 x=10;
  204.                 y=25-pos1;
  205.             }
  206.             else if (pos1<36){
  207.                 x=35-pos1;
  208.                 y=0;
  209.             }
  210.             else if (pos1<40){
  211.                 x=0;
  212.                 y=pos1-35;
  213.             }
  214.            else if (pos1==40){
  215.                  x=1;
  216.                  y=5;
  217.             }
  218.             else if (pos1==41){
  219.                  x=5;
  220.                  y=9;
  221.             }
  222.             else if (pos1==42){
  223.                  x=9;
  224.                  y=5;
  225.             }
  226.             else if (pos1==43){
  227.                  x=5;
  228.                  y=1;
  229.             }
  230.             else if (pos1==44){
  231.                  x=2;
  232.                  y=5;
  233.             }
  234.             else if (pos1==45){
  235.                  x=5;
  236.                  y=8;
  237.             }
  238.             else if (pos1==46){
  239.                  x=8;
  240.                  y=5;
  241.             }
  242.              else if (pos1==47){
  243.                  x=5;
  244.                  y=2;
  245.             }
  246.              else if (pos1==48){
  247.                  x=3;
  248.                  y=5;
  249.             }
  250.              else if (pos1==49){
  251.                 x=7;
  252.                 y=5;
  253.             }
  254.              else if (pos1==50){
  255.                 x=7;
  256.                  y=5;
  257.             }
  258.              else if (pos1==51){
  259.                 x=5;
  260.                  y=3;
  261.             }
  262.              else if (pos1==52){
  263.                  x=4;
  264.                  y=5;
  265.             }
  266.              else if (pos1==53){
  267.                  x=6;
  268.                  y=5;
  269.             }
  270.              else if (pos1==54){
  271.                x=6;
  272.                  y=5;
  273.             }
  274.              else if (pos1==55){
  275.                x=5;
  276.                  y=4;
  277.             }
  278.              else if (pos1==56){
  279.                  x=5;
  280.                  y=5;
  281.             }       
  282.                    
  283.              TabLabel[x][y].setIcon(iconAnimal1);
  284.              
  285.              if (pos2<=5){
  286.                 x=0;
  287.                 y=pos2+5;
  288.             }
  289.             else if (pos2<16){
  290.                 x=pos2-5;
  291.                 y=10;
  292.             }
  293.             else if (pos2<26){
  294.                 x=10;
  295.                 y=25-pos2;
  296.             }
  297.             else if (pos2<36){
  298.                 x=35-pos2;
  299.                 y=0;
  300.             }
  301.             else if (pos2<40){
  302.                 x=0;
  303.                 y=pos2-35;
  304.             }
  305.            else if (pos2==40){
  306.                  x=1;
  307.                  y=5;
  308.             }
  309.             else if (pos2==41){
  310.                  x=5;
  311.                  y=9;
  312.             }
  313.             else if (pos2==42){
  314.                  x=9;
  315.                  y=5;
  316.             }
  317.             else if (pos2==43){
  318.                  x=5;
  319.                  y=1;
  320.             }
  321.             else if (pos2==44){
  322.                  x=2;
  323.                  y=5;
  324.             }
  325.             else if (pos2==45){
  326.                  x=5;
  327.                  y=8;
  328.             }
  329.             else if (pos2==46){
  330.                  x=8;
  331.                  y=5;
  332.             }
  333.              else if (pos2==47){
  334.                  x=5;
  335.                  y=2;
  336.             }
  337.              else if (pos2==48){
  338.                  x=3;
  339.                  y=5;
  340.             }
  341.              else if (pos2==49){
  342.                 x=7;
  343.                 y=5;
  344.             }
  345.              else if (pos2==50){
  346.                 x=7;
  347.                  y=5;
  348.             }
  349.              else if (pos2==51){
  350.                 x=5;
  351.                  y=3;
  352.             }
  353.              else if (pos2==52){
  354.                  x=4;
  355.                  y=5;
  356.             }
  357.              else if (pos2==53){
  358.                  x=6;
  359.                  y=5;
  360.             }
  361.              else if (pos2==54){
  362.                x=6;
  363.                  y=5;
  364.             }
  365.              else if (pos2==55){
  366.                x=5;
  367.                  y=4;
  368.             }
  369.              else if (pos2==56){
  370.                  x=5;
  371.                  y=5;
  372.             }
  373.             
  374.             TabLabel[x][y].setIcon(iconAnimal2);
  375.                     
  376.                     
  377.                     
  378.                     
  379.                     
  380.                     
  381.                     
  382.                     TabLabel [5][5].setIcon(iconAriveer);
  383.                     
  384.                     TabLabel [10][5].setIcon(iconDepart);
  385.                     TabLabel [5][0].setIcon(iconDepart);
  386.                     TabLabel [5][10].setIcon(iconDepart);
  387.                     TabLabel [0][5].setIcon(iconDepart);
  388.                     
  389.                     TabLabel [6][0].setIcon(iconManger);
  390.                     TabLabel [2][0].setIcon(iconManger);
  391.                     TabLabel [10][1].setIcon(iconManger);
  392.                     TabLabel [0][8].setIcon(iconManger);
  393.                     
  394.                     TabLabel [0][2].setIcon(IconJouer);
  395.                     TabLabel [4][10].setIcon(IconJouer);
  396.                     TabLabel [10][2].setIcon(IconJouer);
  397.                     TabLabel [4][0].setIcon(IconJouer);
  398.                     TabLabel [0][6].setIcon(IconJouer);
  399.                     TabLabel [10][6].setIcon(IconJouer);
  400.                     TabLabel [9][10].setIcon(IconJouer);
  401.                     TabLabel [8][0].setIcon(IconJouer);
  402.                     
  403.                     TabLabel [0][9].setIcon(iconDormir);
  404.                     TabLabel [1][10].setIcon(iconDormir);
  405.                     TabLabel [9][0].setIcon(iconDormir);
  406.                     TabLabel [10][8].setIcon(iconDormir);
  407.                     TabLabel [7][10].setIcon(iconDormir);
  408.                     TabLabel [10][3].setIcon(iconDormir);
  409.                     TabLabel [0][4].setIcon(iconDormir);
  410.                     
  411.                     TabLabel [0][0].setIcon(iconPoison);                   
  412.                     TabLabel [0][10].setIcon(iconPoison);
  413.                     TabLabel [10][10].setIcon(iconPoison);                   
  414.                     TabLabel [10][0].setIcon(iconPoison);
  415.                     TabLabel [6][10].setIcon(iconPoison);
  416.                     TabLabel [3][0].setIcon(iconPoison);
  417.                     TabLabel [0][7].setIcon(iconPoison);
  418.                     
  419.                     TabLabel [0][1].setIcon(iconPiege);                   
  420.                     TabLabel [1][0].setIcon(iconPiege);
  421.                     TabLabel [10][7].setIcon(iconPiege);                   
  422.                     TabLabel [10][4].setIcon(iconPiege);
  423.                     TabLabel [8][10].setIcon(iconPiege);
  424.                     TabLabel [7][0].setIcon(iconPiege);
  425.                     TabLabel [10][9].setIcon(iconPiege);
  426.                     TabLabel [2][10].setIcon(iconPiege);
  427.                     TabLabel [3][10].setIcon(iconPiege);
  428.                     TabLabel [0][3].setIcon(iconPiege); 
  429.                     
  430.                     TabLabel [5][9].setIcon(Icon2);
  431.                     TabLabel [5][1].setIcon(Icon2);
  432.                     TabLabel [9][5].setIcon(Icon2);
  433.                     TabLabel [1][5].setIcon(Icon2);
  434.                     
  435.                     TabLabel [5][8].setIcon(Icon4);
  436.                     TabLabel [5][2].setIcon(Icon4);
  437.                     TabLabel [8][5].setIcon(Icon4);
  438.                     TabLabel [2][5].setIcon(Icon4);
  439.                     
  440.                     TabLabel [3][5].setIcon(IconNombre7);
  441.                     TabLabel [5][7].setIcon(IconNombre7);
  442.                     TabLabel [5][3].setIcon(IconNombre7);
  443.                     TabLabel [7][5].setIcon(IconNombre7);
  444.                     
  445.                     TabLabel [4][5].setIcon(IconNombre8);
  446.                     TabLabel [5][6].setIcon(IconNombre8);
  447.                     TabLabel [5][4].setIcon(IconNombre8);
  448.                     TabLabel [6][5].setIcon(IconNombre8);
  449.  
  450.                 }
  451.                  
  452.                 
  453.             }
  454.  
  455.     private void remplirParcours(){ // REMPLIR LES CASES DU TABLEAU 
  456.      
  457.         parcours [3]= 1;
  458.          parcours [9]= 1;
  459.           parcours [15]= 1;
  460.           parcours [21]= 1;
  461.           
  462.           parcours [0]= 6;
  463.           parcours [6]= 6;
  464.           parcours [12]= 6;
  465.           parcours [18]= 6;
  466.           
  467.           parcours [22]= 5;
  468.           parcours [16]= 5;
  469.           parcours [10]= 5;
  470.           parcours [4]= 5;
  471.           
  472.           parcours [1]=2;
  473.           parcours[11]=2;
  474.           parcours[20]=2;
  475.           parcours [7]=2;
  476.           
  477.           parcours[8]=3;
  478.           parcours [2]=3;
  479.           parcours [19]=3;
  480.           parcours [14]=3;
  481.           
  482.           parcours [13]=4;
  483.           parcours [5]=4;
  484.           parcours [23]=4;
  485.           parcours [17]=4;
  486.     }
  487.  
  488.     /**
  489.      * This method is called from within the constructor to initialize the form.
  490.      * WARNING: Do NOT modify this code. The content of this method is always
  491.      * regenerated by the Form Editor.
  492.      */
  493.     @SuppressWarnings("unchecked")
  494.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  495.     private void initComponents() {
  496.  
  497.         jScrollPane1 = new javax.swing.JScrollPane();
  498.         jTextArea1 = new javax.swing.JTextArea();
  499.         bgChoix = new javax.swing.ButtonGroup();
  500.         bValider = new javax.swing.JButton();
  501.         pParcours = new javax.swing.JPanel();
  502.         jLabel1 = new javax.swing.JLabel();
  503.         cbAnimal1 = new javax.swing.JComboBox<>();
  504.         cbAnimal2 = new javax.swing.JComboBox<>();
  505.         rbOui = new javax.swing.JRadioButton();
  506.         rbNon = new javax.swing.JRadioButton();
  507.         jLabel2 = new javax.swing.JLabel();
  508.         bRetour = new javax.swing.JButton();
  509.         jLabel3 = new javax.swing.JLabel();
  510.         jLabel4 = new javax.swing.JLabel();
  511.         jLabel5 = new javax.swing.JLabel();
  512.         lNumero = new javax.swing.JLabel();
  513.         Lance = new javax.swing.JButton();
  514.         bJouer = new javax.swing.JButton();
  515.         Depart = new javax.swing.JLabel();
  516.         label1 = new java.awt.Label();
  517.         label2 = new java.awt.Label();
  518.         label3 = new java.awt.Label();
  519.         label4 = new java.awt.Label();
  520.         label5 = new java.awt.Label();
  521.         label6 = new java.awt.Label();
  522.  
  523.         jTextArea1.setColumns(20);
  524.         jTextArea1.setRows(5);
  525.         jScrollPane1.setViewportView(jTextArea1);
  526.  
  527.         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
  528.         setBackground(new java.awt.Color(0, 0, 0));
  529.  
  530.         bValider.setText("Valider");
  531.         bValider.addActionListener(new java.awt.event.ActionListener() {
  532.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  533.                 bValiderActionPerformed(evt);
  534.             }
  535.         });
  536.  
  537.         pParcours.setBackground(new java.awt.Color(255, 0, 0));
  538.         pParcours.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
  539.         pParcours.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
  540.         pParcours.setLayout(new java.awt.GridLayout(0, 11));
  541.  
  542.         cbAnimal1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Ian", "Grant", "Owen", "Rexy" }));
  543.         cbAnimal1.setToolTipText("");
  544.         cbAnimal1.addActionListener(new java.awt.event.ActionListener() {
  545.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  546.                 cbAnimal1ActionPerformed(evt);
  547.             }
  548.         });
  549.  
  550.         cbAnimal2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Grant", "Owen", "Ian", "Rexy" }));
  551.         cbAnimal2.addActionListener(new java.awt.event.ActionListener() {
  552.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  553.                 cbAnimal2ActionPerformed(evt);
  554.             }
  555.         });
  556.  
  557.         bgChoix.add(rbOui);
  558.         rbOui.setText("Oui");
  559.         rbOui.addActionListener(new java.awt.event.ActionListener() {
  560.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  561.                 rbOuiActionPerformed(evt);
  562.             }
  563.         });
  564.  
  565.         bgChoix.add(rbNon);
  566.         rbNon.setText("non");
  567.  
  568.         jLabel2.setText("Voulez vous avancez?");
  569.  
  570.         bRetour.setText("Retour");
  571.         bRetour.addActionListener(new java.awt.event.ActionListener() {
  572.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  573.                 bRetourActionPerformed(evt);
  574.             }
  575.         });
  576.  
  577.         jLabel4.setText("Joueur 1");
  578.  
  579.         jLabel5.setText("Joueur 2");
  580.  
  581.         lNumero.setText("Numéro Obtenu :");
  582.  
  583.         Lance.setText("Lancé LE dé");
  584.         Lance.addActionListener(new java.awt.event.ActionListener() {
  585.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  586.                 LanceActionPerformed(evt);
  587.             }
  588.         });
  589.  
  590.         bJouer.setText("Jouer");
  591.         bJouer.addActionListener(new java.awt.event.ActionListener() {
  592.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  593.                 bJouerActionPerformed(evt);
  594.             }
  595.         });
  596.  
  597.         Depart.setText("Depart");
  598.  
  599.         label1.setAlignment(java.awt.Label.CENTER);
  600.         label1.setText("InfosJ1");
  601.  
  602.         label2.setText("InfosJ2");
  603.  
  604.         label3.setText("Points de richesses");
  605.  
  606.         label4.setText("Points D'énergies");
  607.  
  608.         label5.setText("Points de richesses");
  609.  
  610.         label6.setText("Points D'énergies");
  611.  
  612.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  613.         getContentPane().setLayout(layout);
  614.         layout.setHorizontalGroup(
  615.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  616.             .addGroup(layout.createSequentialGroup()
  617.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  618.                     .addGroup(layout.createSequentialGroup()
  619.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  620.                             .addGroup(layout.createSequentialGroup()
  621.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  622.                                     .addGroup(layout.createSequentialGroup()
  623.                                         .addContainerGap()
  624.                                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  625.                                             .addComponent(cbAnimal1, 0, 87, Short.MAX_VALUE)
  626.                                             .addComponent(cbAnimal2, 0, 0, Short.MAX_VALUE)
  627.                                             .addComponent(jLabel4)
  628.                                             .addComponent(jLabel5)))
  629.                                     .addGroup(layout.createSequentialGroup()
  630.                                         .addContainerGap()
  631.                                         .addComponent(bValider))
  632.                                     .addGroup(layout.createSequentialGroup()
  633.                                         .addContainerGap()
  634.                                         .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  635.                                     .addGroup(layout.createSequentialGroup()
  636.                                         .addContainerGap()
  637.                                         .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  638.                                     .addGroup(layout.createSequentialGroup()
  639.                                         .addContainerGap()
  640.                                         .addComponent(label4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  641.                                 .addGap(47, 47, 47))
  642.                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  643.                                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  644.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  645.                                     .addComponent(bJouer)
  646.                                     .addComponent(Depart))
  647.                                 .addGap(82, 82, 82)))
  648.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  649.                             .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
  650.                                 .addGap(39, 39, 39)
  651.                                 .addComponent(pParcours, javax.swing.GroupLayout.PREFERRED_SIZE, 651, javax.swing.GroupLayout.PREFERRED_SIZE))
  652.                             .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
  653.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  654.                                     .addComponent(rbNon)
  655.                                     .addGroup(layout.createSequentialGroup()
  656.                                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  657.                                             .addGroup(layout.createSequentialGroup()
  658.                                                 .addGap(319, 319, 319)
  659.                                                 .addComponent(jLabel3)
  660.                                                 .addGap(110, 110, 110))
  661.                                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  662.                                                 .addComponent(lNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
  663.                                                 .addGap(207, 207, 207)))
  664.                                         .addComponent(jLabel2)
  665.                                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  666.                                         .addComponent(rbOui)))
  667.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  668.                                     .addGroup(layout.createSequentialGroup()
  669.                                         .addGap(2, 2, 2)
  670.                                         .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
  671.                                     .addGroup(layout.createSequentialGroup()
  672.                                         .addGap(39, 39, 39)
  673.                                         .addComponent(bRetour))))))
  674.                     .addGroup(layout.createSequentialGroup()
  675.                         .addContainerGap()
  676.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  677.                             .addComponent(label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  678.                             .addComponent(label6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  679.                             .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  680.                     .addComponent(Lance))
  681.                 .addContainerGap(195, Short.MAX_VALUE))
  682.         );
  683.         layout.setVerticalGroup(
  684.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  685.             .addGroup(layout.createSequentialGroup()
  686.                 .addGap(3, 3, 3)
  687.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  688.                     .addGroup(layout.createSequentialGroup()
  689.                         .addComponent(jLabel4)
  690.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  691.                         .addComponent(cbAnimal1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  692.                         .addGap(18, 18, 18)
  693.                         .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
  694.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  695.                         .addComponent(cbAnimal2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  696.                         .addGap(18, 18, 18)
  697.                         .addComponent(bValider)
  698.                         .addGap(41, 41, 41)
  699.                         .addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  700.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  701.                         .addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  702.                         .addGap(40, 40, 40)
  703.                         .addComponent(label4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  704.                     .addComponent(pParcours, javax.swing.GroupLayout.PREFERRED_SIZE, 347, javax.swing.GroupLayout.PREFERRED_SIZE))
  705.                 .addGap(15, 15, 15)
  706.                 .addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  707.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  708.                 .addComponent(label5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  709.                 .addGap(16, 16, 16)
  710.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  711.                     .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
  712.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  713.                             .addGroup(layout.createSequentialGroup()
  714.                                 .addGap(17, 17, 17)
  715.                                 .addComponent(label6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  716.                                 .addGap(57, 57, 57))
  717.                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  718.                                 .addComponent(Lance)
  719.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
  720.                         .addComponent(jLabel3)
  721.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  722.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  723.                             .addComponent(lNumero)
  724.                             .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
  725.                             .addComponent(rbOui)
  726.                             .addComponent(Depart))
  727.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  728.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  729.                             .addGroup(layout.createSequentialGroup()
  730.                                 .addGap(20, 20, 20)
  731.                                 .addComponent(bJouer))
  732.                             .addComponent(rbNon))
  733.                         .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  734.                     .addGroup(layout.createSequentialGroup()
  735.                         .addGap(117, 117, 117)
  736.                         .addComponent(bRetour)
  737.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  738.                         .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
  739.                         .addGap(52, 52, 52))))
  740.         );
  741.  
  742.         pParcours.getAccessibleContext().setAccessibleName("");
  743.         label1.getAccessibleContext().setAccessibleName("Infos1");
  744.  
  745.         pack();
  746.     }// </editor-fold>                        
  747.  
  748. private void bLancerActionPerformed(java.awt.event.ActionEvent evt) {                                        
  749. nbreDe = gen.nextInt(12)+1;
  750. lNumero.setText(nbreDe+"");        // TODO add your handling code here:
  751.         
  752.  
  753.     }       
  754.     private void bValiderActionPerformed(java.awt.event.ActionEvent evt) {                                         
  755.         // TODO add your handling code her
  756.         
  757.         int num = cbAnimal1.getSelectedIndex(); 
  758.         switch (num) {
  759. case 0:
  760. animal1 = new Mammifères ("IanMalcolm",'M',1,50,false); 
  761.      iconAnimal1=IconIanMalcolm;
  762.      TabLabel[0][5].setIcon(iconAnimal1);
  763.     pos1=3;
  764.     pos1 = (pos1+nbreDe) % parcours.length;
  765.     break;
  766. case 1: 
  767. animal1 =new Mammifères ("Grant",'M',1,45,false); 
  768. iconAnimal1=IconGrant;
  769. TabLabel[0][5].setIcon(iconAnimal1);
  770.    pos1=3;
  771.     pos1 = (pos1+nbreDe) % parcours.length;
  772.     break;
  773. case 2: 
  774. animal1 =new Mammifères ("Owen",'M',1,30,false); 
  775. iconAnimal1=IconOwen;
  776. TabLabel[0][5].setIcon(iconAnimal1);
  777.     pos1=3;
  778.         pos1 = (pos1+nbreDe) % parcours.length;
  779.     break;
  780. case 3: 
  781. animal1 =new Mammifères ("Rexy",'M',1,33,false);
  782. iconAnimal1=IconRexy;
  783.     TabLabel[0][5].setIcon(iconAnimal1);
  784.     pos1=3;
  785.     pos1 = (pos1+nbreDe) % parcours.length;
  786.    
  787.         }
  788.         
  789.     int num1 = cbAnimal2.getSelectedIndex();
  790. switch(num1){
  791.     case 0: 
  792.         animal2= new Mammifères ("Ian",'M',1,50,false);
  793.              TabLabel[10][5].setIcon(iconAnimal1);
  794.              iconAnimal2=IconIanMalcolm;
  795.     pos2=2;
  796.     pos2 = (pos2+nbreDe) % parcours.length;
  797.    
  798.         break;
  799.     case 1:
  800.         animal2= new Mammifères ("Grant",'M',1,45,false); 
  801.         TabLabel[10][5].setIcon(iconAnimal1);
  802.         iconAnimal2=IconGrant;
  803.     pos2=2;
  804.     pos2 = (pos2+nbreDe) % parcours.length;
  805.     break;
  806.     
  807.     case 2:
  808.         animal2 = new Mammifères ("Owen",'M',1,30,false);
  809.         TabLabel[10][5].setIcon(iconAnimal1);
  810.         iconAnimal2=IconOwen;
  811.           pos2=2;
  812.           pos2 = (pos2+nbreDe) % parcours.length;
  813.         break;
  814.     case 3 :
  815.         animal3 = new Mammifères ("Rexy",'M',1,33,false);
  816.         TabLabel[10][5].setIcon(iconAnimal1);
  817.         iconAnimal2=IconRexy;
  818.           pos2=2;
  819.           pos2 = (pos2+nbreDe) % parcours.length;
  820.         break;
  821.     
  822.     
  823. }
  824.  
  825.       cbAnimal1.setEnabled(false);  
  826.       cbAnimal2.setEnabled(false); 
  827.       
  828.       label3.setText(animal1.getPts());
  829.       label4.setText(animal2.getPts());
  830.       
  831.       label5.setText(animal2.getPts());
  832.       label6.setText(animal2.getPts()); 
  833.  
  834.     }                                        
  835. //
  836.     private void cbAnimal1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  837.         // TODO add your handling code here:
  838.     }                                         
  839.  
  840.     private void bRetourActionPerformed(java.awt.event.ActionEvent evt) {                                        
  841.         // TODO add your handling code here:
  842.         this.setVisible(false);
  843.         this.getParent().setVisible(true);
  844.     }                                       
  845.  
  846.     private void cbAnimal2ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  847.         // TODO add your handling code here:
  848.     }                                         
  849.  
  850.     private void rbOuiActionPerformed(java.awt.event.ActionEvent evt) {                                      
  851.         // TODO add your handling code here:
  852.     }                                     
  853.  
  854.     private void LanceActionPerformed(java.awt.event.ActionEvent evt) {                                      
  855. nbreDe=gen.nextInt(12)+1;
  856. lNumero.setText(nbreDe+"");
  857. // TODO add your handling code here:
  858.     }                                     
  859.  
  860.     private void bJouerActionPerformed(java.awt.event.ActionEvent evt) {                                       
  861.         // TODO add your handling code here:
  862.         //if (compteur1==0){
  863.            // if (nbreDe==7){
  864.            //    Depart.setText("Joueur 1 commence la partie");
  865.            //    compteur1=compteur1+1;
  866.                
  867.          //   }
  868.          //   else {
  869.          //       Depart.setText("Dommage, tu dois faire un 7 pour avancer");
  870.          //       compteur1=0;
  871.         //        rbOui.setEnabled(false);
  872.         //    }
  873.         
  874.         if  (compteur1==0){
  875.         if (compteur1==0){
  876.            if (nbreDe==7){
  877.                Depart.setText("Bravo Animal 1 ! Tu peux commencer à avancer !");
  878.                compteur1=compteur1+1;
  879.            }
  880.            else {
  881.               Depart.setText("Dommage Animal 1 ! Tu n'as pas fait 7 ! Essaye encore !");
  882.                compteur1=0;
  883.                rbOui.setEnabled(false);
  884.            }
  885.         }
  886.         
  887.         if (compteur1>0){
  888.             rbOui.setEnabled(true);
  889.         if(rbOui.isSelected()==true){
  890.             pos1=pos1+nbreDe;
  891.             compteur1=compteur1+nbreDe;
  892.             if (compteur1<56){
  893.                 switch (parcours[pos1]){
  894.                 case 1 :
  895.                     break;
  896.                 case 2 :
  897.                     animal1.manger(250);
  898.                     break;
  899.                 //case 3 :
  900.                 //    animal1.jouer();
  901.                 //    break;
  902.                 case 4 :
  903.                     animal1.dormir(2);
  904.                     break;
  905.                 case 5 : //OT
  906.                     if(iconAnimal1==IconIanMalcolm|iconAnimal1==IconGrant){
  907.                         pos1=pos1-3;
  908.                     }
  909.                     else if(iconAnimal1==IconOwen){
  910.                         pos1=pos1-1;
  911.                     }
  912.                     break;
  913.                 case 6 : //OA
  914.                     if(iconAnimal1==IconRexy){
  915.                         pos1=pos1-3;
  916.                     }
  917.                     else if(iconAnimal1==IconOwen){
  918.                         pos1=pos1-1;
  919.                     }
  920.                     break;
  921.             }
  922.         System.out.println("Animal 1 = "+compteur1);
  923.             }
  924.             else {
  925.                 if (nbreDe==6){
  926.                    TabLabel[1][5].setIcon(iconAnimal1);
  927.                    if(nbreDe==8){
  928.                        TabLabel[2][5].setIcon(iconAnimal1);
  929.                        if (nbreDe==10){
  930.                           TabLabel[5][5].setIcon(iconAnimal1);
  931.                           Depart.setText("Bravo Animal 1 ! Tu as gagné !");
  932.                        }
  933.                    }
  934.                    else {
  935.                        
  936.                    }
  937.                 }
  938.                 else {
  939.                     
  940.                 }
  941.             }
  942.             }
  943.         }
  944.         else {
  945.             
  946.         }
  947.        // Jouer.setEnabled(false);
  948.       //  compteur2=1;
  949. }
  950.  
  951. else {
  952.         if (compteur1==0){
  953.            if (nbreDe==6){
  954.                Depart.setText("Bravo Animal 2 ! Tu peux commencer à avancer !");
  955.                compteur1=compteur1+1;
  956.            }
  957.            else {
  958.                Depart.setText("Dommage Animal 2 ! Tu n'as pas fait 6 ! Essaye encore !");
  959.                compteur1=0;
  960.                rbOui.setEnabled(false);
  961.            }
  962.            
  963.         }
  964.         
  965.     }                                      
  966.             afficherParcours();
  967.         if (compteur1>0){
  968.             rbOui.setEnabled(true);
  969.         if(rbOui.isSelected()==true){
  970.             
  971.             pos2=pos2+nbreDe;
  972.             compteur1=compteur1+nbreDe;
  973.             if (compteur1<56){
  974.                switch (parcours[pos2]){
  975.                 case 1 :
  976.                     break;
  977.                 //case 2 :
  978.                  //   animal2.manger(250);
  979.                  //   break;
  980.                 case 3 :
  981.                     //animal2.jouer();
  982.                     break;
  983.                 case 4 :
  984.                     animal2.dormir(2);
  985.                     break;
  986.                 case 5 : //OT
  987.                     if(iconAnimal2==IconIanMalcolm|iconAnimal2==IconGrant){
  988.                         pos1=pos1-3;
  989.                     }
  990.                     else if(iconAnimal2==IconOwen){
  991.                         pos1=pos1-1;
  992.                     }
  993.                     else {
  994.                         
  995.                     }
  996.                     break;
  997.                 case 6 : //OA
  998.                     if(iconAnimal2==IconRexy){
  999.                         pos1=pos1-3;
  1000.                     }
  1001.                     else if(iconAnimal2==IconOwen){
  1002.                         pos1=pos1-1;
  1003.                     }
  1004.                     else {
  1005.                         
  1006.                     }
  1007.                     break;
  1008.                }
  1009.                System.out.println("Animal 2 = "+compteur1);
  1010.             }
  1011.             else {
  1012.                 if (nbreDe==6){
  1013.                    TabLabel[8][5].setIcon(iconAnimal2);
  1014.                    if(nbreDe==9){
  1015.                        TabLabel[6][5].setIcon(iconAnimal2);
  1016.                        if (nbreDe==10){
  1017.                           TabLabel[5][5].setIcon(iconAnimal2);
  1018.                           Depart.setText("Bravo Animal 2 ! Tu as gagné !");
  1019.                        }
  1020.                    }
  1021.                    else {
  1022.                        
  1023.                    }
  1024.                 }
  1025.                 else {
  1026.                     
  1027.                 }
  1028.             }
  1029.  
  1030.             
  1031.         
  1032.     }                                     
  1033.            else {
  1034.                     
  1035.                     }
  1036.         }
  1037.         afficherParcours();
  1038.     //    Jouer.setEnabled(false);
  1039.      //   compteur2=0;
  1040.     }
  1041.  
  1042.     /**
  1043.      * @param args the command line arguments
  1044.      */
  1045.     public static void main(String args[]) {
  1046.         /* Set the Nimbus look and feel */
  1047.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  1048.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  1049.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
  1050.          */
  1051.         try {
  1052.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  1053.                 if ("Nimbus".equals(info.getName())) {
  1054.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  1055.                     break;
  1056.                 }
  1057.             }
  1058.         } catch (ClassNotFoundException ex) {
  1059.             java.util.logging.Logger.getLogger(Fjeu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  1060.         } catch (InstantiationException ex) {
  1061.             java.util.logging.Logger.getLogger(Fjeu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  1062.         } catch (IllegalAccessException ex) {
  1063.             java.util.logging.Logger.getLogger(Fjeu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  1064.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  1065.             java.util.logging.Logger.getLogger(Fjeu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  1066.         }
  1067.         //</editor-fold>
  1068.  
  1069.         /* Create and display the dialog */
  1070.         java.awt.EventQueue.invokeLater(new Runnable() {
  1071.             public void run() {
  1072.                 Fjeu dialog = new Fjeu(new javax.swing.JFrame(), true);
  1073.                 dialog.addWindowListener(new java.awt.event.WindowAdapter() {
  1074.                     @Override
  1075.                     public void windowClosing(java.awt.event.WindowEvent e) {
  1076.                         System.exit(0);
  1077.                     }
  1078.                 });
  1079.                 dialog.setVisible(true);
  1080.             }
  1081.         });
  1082.     }
  1083.  
  1084.     // Variables declaration - do not modify                     
  1085.     private javax.swing.JLabel Depart;
  1086.     private javax.swing.JButton Lance;
  1087.     private javax.swing.JButton bJouer;
  1088.     private javax.swing.JButton bRetour;
  1089.     private javax.swing.JButton bValider;
  1090.     private javax.swing.ButtonGroup bgChoix;
  1091.     private javax.swing.JComboBox<String> cbAnimal1;
  1092.     private javax.swing.JComboBox<String> cbAnimal2;
  1093.     private javax.swing.JLabel jLabel1;
  1094.     private javax.swing.JLabel jLabel2;
  1095.     private javax.swing.JLabel jLabel3;
  1096.     private javax.swing.JLabel jLabel4;
  1097.     private javax.swing.JLabel jLabel5;
  1098.     private javax.swing.JScrollPane jScrollPane1;
  1099.     private javax.swing.JTextArea jTextArea1;
  1100.     private javax.swing.JLabel lNumero;
  1101.     private java.awt.Label label1;
  1102.     private java.awt.Label label2;
  1103.     private java.awt.Label label3;
  1104.     private java.awt.Label label4;
  1105.     private java.awt.Label label5;
  1106.     private java.awt.Label label6;
  1107.     private javax.swing.JPanel pParcours;
  1108.     private javax.swing.JRadioButton rbNon;
  1109.     private javax.swing.JRadioButton rbOui;
  1110.     // End of variables declaration                   
  1111. }

Editor

You can edit this paste and save as new: