package UhuRisk;


import java.util.ArrayList;

/*
 * JCartas.java
 *
 * Created on 21 de enero de 2009, 16:06
 */



/**
 *
 * @author  Pilarika
 */
public class JCartas extends javax.swing.JFrame {
    
    private fTablero tablero;
    
    private ArrayList<javax.swing.JLabel> ldibujos;
    
    private ArrayList<javax.swing.JLabel> lnombres;
    
    private ArrayList<javax.swing.JPanel> lpcartas;
    /** Creates new form JCartas */
    public JCartas(fTablero tab) {
       initComponents();
       tablero=tab;
       lnombres=new ArrayList();
       lnombres.add(jLCarta1);
       lnombres.add(jLCarta2);
       lnombres.add(jLCarta3);
       lnombres.add(jLCarta4);
       lnombres.add(jLCarta5);
       lnombres.add(jLCarta6);
       ldibujos=new ArrayList();
       ldibujos.add(jLImagen1);
       ldibujos.add(jLImagen2);
       ldibujos.add(jLImagen3);
       ldibujos.add(jLImagen4);
       ldibujos.add(jLImagen5);
       ldibujos.add(jLImagen6);
       lpcartas=new ArrayList();
       lpcartas.add(JPCarta1);
       lpcartas.add(JPCarta2);
       lpcartas.add(JPCarta3);
       lpcartas.add(JPCarta4);
       lpcartas.add(JPCarta5);
       lpcartas.add(JPCarta6);
       int numcartas=tablero.getMiPartida().getJugador(tablero.getMiPartida().getJugadorActivo()).getnumCartas();
       ArrayList<Carta_Territorio> aux=tablero.getMiPartida().getJugador(tablero.getMiPartida().getJugadorActivo()).getCarta_Territorio();
       int i;
       for(i=0; i<numcartas; i++){
           lnombres.get(i).setText(aux.get(i).getNomCarta());
           String tipo=aux.get(i).getTipoEjercito();
           if(tipo.compareTo("Galeon")==0){
               ldibujos.get(i).setIcon(new javax.swing.ImageIcon(getClass().getResource("/CGALEON.jpg")));
           }
           else if(tipo.compareTo("Bajel")==0){
               ldibujos.get(i).setIcon(new javax.swing.ImageIcon(getClass().getResource("/CBAJEL.jpg")));
           }
           else if(tipo.compareTo("Barcaza")==0){
               ldibujos.get(i).setIcon(new javax.swing.ImageIcon(getClass().getResource("/CBARCA.jpg")));
           }
       }
       
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        JPCarta1 = new javax.swing.JPanel();
        jLImagen1 = new javax.swing.JLabel();
        jLCarta1 = new javax.swing.JLabel();
        JPCarta2 = new javax.swing.JPanel();
        jLImagen2 = new javax.swing.JLabel();
        jLCarta2 = new javax.swing.JLabel();
        JPCarta3 = new javax.swing.JPanel();
        jLImagen3 = new javax.swing.JLabel();
        jLCarta3 = new javax.swing.JLabel();
        JPCarta4 = new javax.swing.JPanel();
        jLImagen4 = new javax.swing.JLabel();
        jLCarta4 = new javax.swing.JLabel();
        JPCarta6 = new javax.swing.JPanel();
        jLImagen6 = new javax.swing.JLabel();
        jLCarta6 = new javax.swing.JLabel();
        JPCarta5 = new javax.swing.JPanel();
        jLImagen5 = new javax.swing.JLabel();
        jLCarta5 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButton1.setText("Volver");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        JPCarta1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLImagen1.setOpaque(true);

        jLCarta1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLCarta1.setOpaque(true);

        javax.swing.GroupLayout JPCarta1Layout = new javax.swing.GroupLayout(JPCarta1);
        JPCarta1.setLayout(JPCarta1Layout);
        JPCarta1Layout.setHorizontalGroup(
            JPCarta1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPCarta1Layout.createSequentialGroup()
                .addGroup(JPCarta1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLImagen1, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLCarta1, javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE))
                .addContainerGap())
        );
        JPCarta1Layout.setVerticalGroup(
            JPCarta1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPCarta1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLCarta1, javax.swing.GroupLayout.DEFAULT_SIZE, 16, Short.MAX_VALUE)
                .addGap(31, 31, 31)
                .addComponent(jLImagen1, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        JPCarta2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLImagen2.setOpaque(true);

        jLCarta2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLCarta2.setOpaque(true);

        javax.swing.GroupLayout JPCarta2Layout = new javax.swing.GroupLayout(JPCarta2);
        JPCarta2.setLayout(JPCarta2Layout);
        JPCarta2Layout.setHorizontalGroup(
            JPCarta2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPCarta2Layout.createSequentialGroup()
                .addGroup(JPCarta2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLCarta2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                    .addComponent(jLImagen2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        JPCarta2Layout.setVerticalGroup(
            JPCarta2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPCarta2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLCarta2, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                .addComponent(jLImagen2, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        JPCarta3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLImagen3.setOpaque(true);

        jLCarta3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLCarta3.setOpaque(true);

        javax.swing.GroupLayout JPCarta3Layout = new javax.swing.GroupLayout(JPCarta3);
        JPCarta3.setLayout(JPCarta3Layout);
        JPCarta3Layout.setHorizontalGroup(
            JPCarta3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPCarta3Layout.createSequentialGroup()
                .addGroup(JPCarta3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(JPCarta3Layout.createSequentialGroup()
                        .addGap(63, 63, 63)
                        .addComponent(jLCarta3))
                    .addComponent(jLImagen3, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        JPCarta3Layout.setVerticalGroup(
            JPCarta3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPCarta3Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jLCarta3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
                .addComponent(jLImagen3, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        JPCarta4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLImagen4.setOpaque(true);

        jLCarta4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLCarta4.setOpaque(true);

        javax.swing.GroupLayout JPCarta4Layout = new javax.swing.GroupLayout(JPCarta4);
        JPCarta4.setLayout(JPCarta4Layout);
        JPCarta4Layout.setHorizontalGroup(
            JPCarta4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPCarta4Layout.createSequentialGroup()
                .addGroup(JPCarta4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLImagen4, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(JPCarta4Layout.createSequentialGroup()
                        .addGap(51, 51, 51)
                        .addComponent(jLCarta4)))
                .addContainerGap(1, Short.MAX_VALUE))
        );
        JPCarta4Layout.setVerticalGroup(
            JPCarta4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPCarta4Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jLCarta4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
                .addComponent(jLImagen4, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        JPCarta6.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLImagen6.setOpaque(true);

        jLCarta6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLCarta6.setOpaque(true);

        javax.swing.GroupLayout JPCarta6Layout = new javax.swing.GroupLayout(JPCarta6);
        JPCarta6.setLayout(JPCarta6Layout);
        JPCarta6Layout.setHorizontalGroup(
            JPCarta6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPCarta6Layout.createSequentialGroup()
                .addGroup(JPCarta6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLImagen6, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(JPCarta6Layout.createSequentialGroup()
                        .addGap(149, 149, 149)
                        .addComponent(jLCarta6)))
                .addContainerGap(3, Short.MAX_VALUE))
        );
        JPCarta6Layout.setVerticalGroup(
            JPCarta6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPCarta6Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jLCarta6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
                .addComponent(jLImagen6, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        JPCarta5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLImagen5.setOpaque(true);

        jLCarta5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLCarta5.setOpaque(true);

        javax.swing.GroupLayout JPCarta5Layout = new javax.swing.GroupLayout(JPCarta5);
        JPCarta5.setLayout(JPCarta5Layout);
        JPCarta5Layout.setHorizontalGroup(
            JPCarta5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JPCarta5Layout.createSequentialGroup()
                .addGroup(JPCarta5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLImagen5, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(JPCarta5Layout.createSequentialGroup()
                        .addGap(51, 51, 51)
                        .addComponent(jLCarta5)))
                .addContainerGap(8, Short.MAX_VALUE))
        );
        JPCarta5Layout.setVerticalGroup(
            JPCarta5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, JPCarta5Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jLCarta5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
                .addComponent(jLImagen5, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(36, 36, 36)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(JPCarta1, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(JPCarta2, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(JPCarta4, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(JPCarta5, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(12, 12, 12)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(JPCarta6, 0, 154, Short.MAX_VALUE)
                    .addComponent(JPCarta3, javax.swing.GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE))
                .addGap(121, 121, 121)
                .addComponent(jButton1)
                .addGap(185, 185, 185))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(JPCarta1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JPCarta2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(JPCarta3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton1)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(JPCarta6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(JPCarta5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(JPCarta4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(38, 38, 38))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    tablero.setEnabled(true);
    this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed

    /**
    * @param args the command line arguments
    */
   /* public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new JCartas().setVisible(true);
            }
        });
    }*/
    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel JPCarta1;
    private javax.swing.JPanel JPCarta2;
    private javax.swing.JPanel JPCarta3;
    private javax.swing.JPanel JPCarta4;
    private javax.swing.JPanel JPCarta5;
    private javax.swing.JPanel JPCarta6;
    private javax.swing.JPanel JPCarta8;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLCarta1;
    private javax.swing.JLabel jLCarta2;
    private javax.swing.JLabel jLCarta3;
    private javax.swing.JLabel jLCarta4;
    private javax.swing.JLabel jLCarta5;
    private javax.swing.JLabel jLCarta6;
    private javax.swing.JLabel jLCarta8;
    private javax.swing.JLabel jLImagen1;
    private javax.swing.JLabel jLImagen2;
    private javax.swing.JLabel jLImagen3;
    private javax.swing.JLabel jLImagen4;
    private javax.swing.JLabel jLImagen5;
    private javax.swing.JLabel jLImagen6;
    private javax.swing.JLabel jLImagen8;
    // End of variables declaration//GEN-END:variables

    
    
}
