
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Image;
import java.util.Observable;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.Observer;
import javax.swing.ImageIcon;
import javax.swing.JLabel;


public class jfrmTablero extends javax.swing.JFrame implements Observer {
    int idTerritorioOrigen=-1;
    int idTerritorioDestino=-1;
    boolean activartablero=false;
    Juego j;
    int n;
    jfrmInicio jfrmI;
    jFrameGanador jGanador;
    jfrmVerEstado jVerEstad;
    jfrmCargarPartida jfrmCP;
    //Tablero t;
    MP3 creacionPartida=new MP3("./sonido/principal1.mp3");
    MP3 pantallaPrincipal=new MP3("./sonido/principal2.mp3");
    MP3 ataque=new MP3("./sonido/ataque.mp3");
    MP3 victoria=new MP3("./sonido/victoria.mp3");
    MP3 aplausos=new MP3("./sonido/aplausos.mp3");
    MP3 invasion=new MP3("./sonido/invasion.mp3");
    MP3 abandono=new MP3("./sonido/abandono.mp3");
    ArrayList<JLabel> Labels=new ArrayList();//Para el asunto del barrido.
    /*    Icon bRoja= new Icon() {

        public void paintIcon(Component c, Graphics g, int x, int y) {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public int getIconWidth() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

        public int getIconHeight() {
            throw new UnsupportedOperationException("Not supported yet.");
        }
     };  */  
   
    private JPanel panel;
    private boolean partidaComenzada;
    private boolean faseAtaque;
    private boolean faseRefuerzo;
    private boolean fasePrevia;
    private int dame_carta=0;
     
    /** Creates new form jfrmTablero */
    public jfrmTablero(Juego j) {
        initComponents();
        this.j=j;        
        //ControladorBD.getData().toArray(new Object[] {});
        jButtonComenzarPartida.setVisible(true);
        jButtonAtacar.setVisible(false);
        jButtonCanjearCartas.setVisible(false);
        jButtonTransferirTropas.setVisible(false);
        jButtonVerEstado.setVisible(false);
        jButtonAnularSeleccion.setVisible(false);
        jButtonFinalizarTurno.setVisible(false);
        jButtonSalir.setVisible(true);
        jButtonFinalizarFaseAtaque.setVisible(false);
        jButtonGuardarPartida.setVisible(false);
        jButtonInvadir.setVisible(false);
        jButtonAbandonar.setVisible(false);
        jfrmI=new jfrmInicio(j);
        
        //jGanador=new jFrameGanador(j);
        jVerEstad=new jfrmVerEstado(j);
        jfrmI.setVisible(false);
        //jfrmCP.setVisible(false);
        //jGanador.setVisible(false);
        jVerEstad.setVisible(false);
        Labels.add(jLabelTerritorio0);
        Labels.add(jLabelTerritorio1);
        Labels.add(jLabelTerritorio2);
        Labels.add(jLabelTerritorio3_1);
        Labels.add(jLabelTerritorio4);
        Labels.add(jLabelTerritorio5_1);
        Labels.add(jLabelTerritorio6_1);
        Labels.add(jLabelTerritorio7);
        Labels.add(jLabelTerritorio8);
        Labels.add(jLabelTerritorio9);
        Labels.add(jLabelTerritorio10);
        Labels.add(jLabelTerritorio11);
        Labels.add(jLabelTerritorio12);
        Labels.add(jLabelTerritorio13);
        Labels.add(jLabelTerritorio14);
        Labels.add(jLabelTerritorio15);
        Labels.add(jLabelTerritorio16);
        Labels.add(jLabelTerritorio17_1);
        Labels.add(jLabelTerritorio18);
        Labels.add(jLabelTerritorio19);
        Labels.add(jLabelTerritorio20);
        Labels.add(jLabelTerritorio21);
        Labels.add(jLabelTerritorio22);
        Labels.add(jLabelTerritorio23_1);
        Labels.add(jLabelTerritorio24_1);
        Labels.add(jLabelTerritorio25_1);
        Labels.add(jLabelTerritorio26_1);
        Labels.add(jLabelTerritorio27_1);
        Labels.add(jLabelTerritorio28);
        Labels.add(jLabelTerritorio29);
        Labels.add(jLabelTerritorio30_1);
        Labels.add(jLabelTerritorio31);
        Labels.add(jLabelTerritorio32);
        Labels.add(jLabelTerritorio33);
        Labels.add(jLabelTerritorio34_1);
        Labels.add(jLabelTerritorio35);
        Labels.add(jLabelTerritorio36);
        Labels.add(jLabelTerritorio37);
        Labels.add(jLabelTerritorio38);
        Labels.add(jLabelTerritorio39_1);
        Labels.add(jLabelTerritorio40);
        Labels.add(jLabelTerritorio41);
        Labels.add(jLabelTerritorio42_1);
        Labels.add(jLabelTerritorio43_1);
        Labels.add(jLabelTerritorio44_1);
        Labels.add(jLabelTerritorio45);
        Labels.add(jLabelTerritorio46);
        Labels.add(jLabelTerritorio47_1);
        Labels.add(jLabelTerritorio48_1);
        Labels.add(jLabelTerritorio49);
        Labels.add(jLabelTerritorio50_1);
        Labels.add(jLabelTerritorio51);
        //bRoja=Labels.get(1).getDisabledIcon();
        //bGris=Labels.get(1).getIcon();
        //dados atacantes
        jLabelTiradaAtacante.setVisible(false);
        jLabelImageDado1Ataca.setVisible(false);
        jLabelImageDado2Ataca.setVisible(false);
        jLabelImageDado3Ataca.setVisible(false);
        //dados defensores
        jLabelTiradaDefensor.setVisible(false);
        jLabelImageDado1Def.setVisible(false);
        jLabelImageDado2Def.setVisible(false);
        creacionPartida.play();
    }
    
    /** 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")
    
    public void barridoBotones(){
        if(faseRefuerzo){
            jButtonComenzarPartida.setVisible(false);
            jButtonAtacar.setVisible(false);
            jButtonCanjearCartas.setVisible(true);
            jButtonTransferirTropas.setVisible(false);
            jButtonVerEstado.setVisible(true);
            jButtonAnularSeleccion.setVisible(false);
            jButtonFinalizarTurno.setVisible(false);
            jButtonSalir.setVisible(true);
            jButtonFinalizarFaseAtaque.setVisible(false);
            jButtonGuardarPartida.setVisible(true);
            jButtonInvadir.setVisible(false);
            jButtonAbandonar.setVisible(true);
        }
        
        else if (faseAtaque){
            jButtonComenzarPartida.setVisible(false);
            jButtonAtacar.setVisible(true);
            jButtonCanjearCartas.setVisible(false);
            jButtonTransferirTropas.setVisible(false);
            jButtonVerEstado.setVisible(true);
            jButtonAnularSeleccion.setVisible(true);
            jButtonFinalizarTurno.setVisible(false);
            jButtonSalir.setVisible(true);
            jButtonFinalizarFaseAtaque.setVisible(true);
            jButtonGuardarPartida.setVisible(true);
            jButtonInvadir.setVisible(false);
            jButtonAbandonar.setVisible(true);
        }
        else{
            jButtonComenzarPartida.setVisible(false);
            jButtonAtacar.setVisible(false);
            jButtonCanjearCartas.setVisible(false);
            jButtonTransferirTropas.setVisible(true);
            jButtonVerEstado.setVisible(true);
            jButtonAnularSeleccion.setVisible(true);
            jButtonFinalizarTurno.setVisible(true);
            jButtonSalir.setVisible(true);
            jButtonFinalizarFaseAtaque.setVisible(false);
            jButtonGuardarPartida.setVisible(true);
            jButtonInvadir.setVisible(false);
            jButtonAbandonar.setVisible(true);
        }
        anularSeleccion();
    }
    
    
    public void lanzarAtaque(){
    NOmuestraDados();
    if(j.getjugadores(j.gettur()).ExisteTerritorio(j.getTerrtiorio(idTerritorioDestino))){
        jLabelTextoInformacion.setText("No puedes atacar tus propios territorios, tontolkulo!!");
    }
    else{
    if(jTextIntroduceInfo.getText().isEmpty()){
        jLabelTextoInformacion.setText("Debes introducir 1, 2 o 3 tropas para el ataque");
    }
    else{
        String s=jTextIntroduceInfo.getText();
        int numTropas=Integer.parseInt(s);
        int numTropasDestino=0;
        if(numTropas>3 || numTropas<1){
            jLabelTextoInformacion.setText("Valor de tropas inválido");
        }
        else{
            if (j.getTerrtiorio(idTerritorioOrigen).getNumTropas()-1<numTropas){
                jLabelTextoInformacion.setText("No puedes dejar el territorio "+j.getTerrtiorio(idTerritorioOrigen).getNomTerritorio()+" vacio!!");
            }
            else{
                if(numTropas==3 || numTropas==2) numTropasDestino=2;
                else if(numTropas==1) numTropasDestino=1;
                if(numTropasDestino>j.getTerrtiorio(idTerritorioDestino).getNumTropas()){
                    numTropasDestino--;
                }
                int[] tiradas=j.batalla(idTerritorioOrigen,idTerritorioDestino, numTropas, numTropasDestino);
                ataque.play();
                //String prueba=tiradas.toString();
                //jLabelTextoInformacion.setText(prueba);
                jLabelTextoInformacion.setText("Tiradas de ataque: "+tiradas[0]+", "+tiradas[1]+", "+tiradas[2]+". Tiradas de Defensa: "+tiradas[3]+", "+tiradas[4]+".");
                if(j.getTerrtiorio(idTerritorioDestino).getNumTropas()<1){
                    jLabelTextoInfo2.setText("Introduce el número de tropas con el que invadirás "+j.getTerrtiorio(idTerritorioDestino).getNomTerritorio()+" y pulsa Invadir");
                    jButtonAtacar.setVisible(false);
                    jButtonCanjearCartas.setVisible(false);
                    jButtonTransferirTropas.setVisible(false);
                    jButtonVerEstado.setVisible(false);
                    jButtonAnularSeleccion.setVisible(false);
                    jButtonFinalizarTurno.setVisible(false);
                    jButtonSalir.setVisible(false);
                    jButtonGuardarPartida.setVisible(false);
                    jButtonInvadir.setVisible(true);
                    jButtonAbandonar.setVisible(false);
                    jButtonFinalizarFaseAtaque.setVisible(false);
                }
                
                muestraDados(tiradas);
            }
        } 
    }   
    barrido();
    }
    }  
    public void muestraDados(int[] tiradas){
    //5 dados -> como maximo 3 dados de ataque y 2 de defensa
        ImageIcon ImageDado1 = null,ImageDado2 = null,ImageDado3=null,ImageDado4=null,ImageDado5=null;
      
      for (int i=0;i<5;i++){
        if (tiradas[i]==1){
            if (i==0)
              ImageDado1=new ImageIcon("./imagenes/dado1.gif");                          
            else if(i==1)
              ImageDado2=new ImageIcon("./imagenes/dado1.gif");            
            else if(i==2)
              ImageDado3=new ImageIcon("./imagenes/dado1.gif");              
            else if(i==3)
              ImageDado4=new ImageIcon("./imagenes/dado1.gif");            
            else if(i==4)
              ImageDado5=new ImageIcon("./imagenes/dado1.gif");                         
        }
        else if (tiradas[i]==2){
            if (i==0)
              ImageDado1=new ImageIcon("./imagenes/dado2.gif");            
            else if(i==1)
              ImageDado2=new ImageIcon("./imagenes/dado2.gif");            
            else if(i==2)
              ImageDado3=new ImageIcon("./imagenes/dado2.gif");                          
            else if(i==3)
              ImageDado4=new ImageIcon("./imagenes/dado2.gif");            
            else if(i==4)
              ImageDado5=new ImageIcon("./imagenes/dado2.gif");              
        }        
        else if (tiradas[i]==3){
            if (i==0)
              ImageDado1=new ImageIcon("./imagenes/dado3.gif");            
            else if(i==1)
              ImageDado2=new ImageIcon("./imagenes/dado3.gif");            
            else if(i==2)
              ImageDado3=new ImageIcon("./imagenes/dado3.gif");                          
            else if(i==3)
              ImageDado4=new ImageIcon("./imagenes/dado3.gif");            
            else if(i==4)
              ImageDado5=new ImageIcon("./imagenes/dado3.gif");              
        }
        else if (tiradas[i]==4){
            if (i==0)
              ImageDado1=new ImageIcon("./imagenes/dado4.gif");            
            else if(i==1)
              ImageDado2=new ImageIcon("./imagenes/dado4.gif");            
            else if(i==2)
              ImageDado3=new ImageIcon("./imagenes/dado4.gif");                          
            else if(i==3)
              ImageDado4=new ImageIcon("./imagenes/dado4.gif");            
            else if(i==4)
              ImageDado5=new ImageIcon("./imagenes/dado4.gif");              
        }              
        else if (tiradas[i]==5){
            if (i==0)
              ImageDado1=new ImageIcon("./imagenes/dado5.gif");            
            else if(i==1)
              ImageDado2=new ImageIcon("./imagenes/dado5.gif");            
            else if(i==2)
              ImageDado3=new ImageIcon("./imagenes/dado5.gif");                          
            else if(i==3)
              ImageDado4=new ImageIcon("./imagenes/dado5.gif");            
            else if(i==4)
              ImageDado5=new ImageIcon("./imagenes/dado5.gif");               
        }        
        else if (tiradas[i]==6){
            if (i==0)
              ImageDado1=new ImageIcon("./imagenes/dado6.gif");            
            else if(i==1)
              ImageDado2=new ImageIcon("./imagenes/dado6.gif");            
            else if(i==2)
              ImageDado3=new ImageIcon("./imagenes/dado6.gif");                            
            else if(i==3)
              ImageDado4=new ImageIcon("./imagenes/dado6.gif");            
            else if(i==4)
              ImageDado5=new ImageIcon("./imagenes/dado6.gif");                
        }
      }//for
        jLabelTiradaAtacante.setVisible(true);
        jLabelImageDado1Ataca.setIcon(ImageDado1);
        jLabelImageDado1Ataca.setVisible(true);
        if(ImageDado2!=null){
            jLabelImageDado2Ataca.setIcon(ImageDado2);
            jLabelImageDado2Ataca.setVisible(true);
            if(ImageDado3!=null){
                jLabelImageDado3Ataca.setIcon(ImageDado3);
                jLabelImageDado3Ataca.setVisible(true);
            }
        }
        jLabelTiradaDefensor.setVisible(true);
        jLabelImageDado1Def.setIcon(ImageDado4);
        jLabelImageDado1Def.setVisible(true);
        if(ImageDado5!=null){
            jLabelImageDado2Def.setIcon(ImageDado5);
            jLabelImageDado2Def.setVisible(true);
        }
    }
    public void NOmuestraDados(){
        jLabelTiradaAtacante.setVisible(false);
        jLabelImageDado1Ataca.setVisible(false);
        jLabelImageDado2Ataca.setVisible(false);
        jLabelImageDado3Ataca.setVisible(false);
       
        jLabelTiradaDefensor.setVisible(false);
        jLabelImageDado1Def.setVisible(false);
        jLabelImageDado2Def.setVisible(false);
    }
    public void asignaTerritorioClickado(int terr){
      jLabelTextoInformacion.setText("");
        jLabelTextoInfo2.setText("");
      //barrido();
      if(activartablero){  
        if (idTerritorioOrigen==-1){
            idTerritorioOrigen=terr;
            jLabelTextoOrigen.setText(j.getTerrtiorio(idTerritorioOrigen).getNomTerritorio());
            String NumTropasOrigen=Integer.toString(j.getTerrtiorio(idTerritorioOrigen).getNumTropas());
            jLabelTextoTropasOrigen.setText(NumTropasOrigen);
            if(fasePrevia){
                ubicarTropasFasePrevia();
            }
            
            else if(!faseRefuerzo){    
                if(partidaComenzada){
                    barridoVecinos(j.getTerrtiorio(idTerritorioOrigen));
                }
            }
            else{
                ubicarTropas();
            }
        }
        else if(idTerritorioDestino==-1){
            idTerritorioDestino=terr;
            jLabelTextoDestino.setText(j.getTerrtiorio(idTerritorioDestino).getNomTerritorio());
            String NumTropasDestino=Integer.toString(j.getTerrtiorio(idTerritorioDestino).getNumTropas());
            jLabelTextoTropasDestino.setText(NumTropasDestino);
        }
    }
    }
    
    public void anularSeleccion(){
        NOmuestraDados();
        jLabelTextoInformacion.removeAll();
        idTerritorioDestino=-1;
        jLabelTextoDestino.setText("");
        jLabelTextoTropasOrigen.setText("");
        idTerritorioOrigen=-1;
        jLabelTextoOrigen.setText("");
        jLabelTextoTropasDestino.setText("");
        barrido();
    }
       
    
    public void comenzarPartida(){
        if(j.getNumJugadores()<jfrmI.getNumJugadoresIntroducidos() || j.getNumJugadores()<1){
            jLabelTextoInformacion.setText("Debes crear la partida primero, o cargarla");
        }
        
        else{
            //pantallaPrincipal.play();
            creacionPartida.close();
            pantallaPrincipal.play();
            j.reparteTerritorios();
            j.asignarTurnos();
            jLabelTextoInformacion.setText("Te quedan "+ j.getjugadores(j.gettur()).getTropasPendUbicar()+" tropas por ubicar");
            //System.out.println("Mediante sorteo se ha decidido que sea "+j.getjugadores(j.gettur()).getNombre()+" el que comienze");
            jLabelTextoInfo2.setText("Mediante sorteo se ha decidido que sea "+j.getjugadores(j.gettur()).getNombre()+" el que comienze");
            activartablero=true;
            fasePrevia=true;
            jButtonCrearNuevaPartida.setVisible(false);
            jButtonVerHistorico.setVisible(false);
            jButtonComenzarPartida.setVisible(false);
            jButtonFinalizarFaseAtaque.setVisible(false);
            barridoPoseedores();
            barrido();
        }
    }
    
    public void barridoPoseedor(int idJugador){
        
        ImageIcon ImageBandera = null;
            for(int i=0;i<Labels.size();i++){
                if(j.getjugadores(idJugador).ExisteTerritorio(j.getTerrtiorio(i))){
                    switch(idJugador){
                        case 0: ImageBandera = new ImageIcon("./imagenes/bRoja.gif");break;
                        case 1: ImageBandera = new ImageIcon("./imagenes/bAzul.gif");break;
                        case 2: ImageBandera = new ImageIcon("./imagenes/bVerde.gif");break;
                        case 3: ImageBandera = new ImageIcon("./imagenes/bAmarilla.gif");break;
                        case 4: ImageBandera = new ImageIcon("./imagenes/bMorada.gif");break;
                        case 5: ImageBandera = new ImageIcon("./imagenes/bBlanca.gif");break;
                    }
                    Labels.get(i).setIcon(ImageBandera);
                }
            }
        
        
    }
    
    public void barridoPoseedores(){
        
        for (int i=0;i<j.getNumJugadores();i++){
            barridoPoseedor(i);
        }
        
    }
    
    
    public void barrido(){
    //jLabelTextoInfo2.setText(text);
    for(int i=0;i<Labels.size();i++){
         
        Labels.get(i).setVisible(true);
        if(j.getjugadores(j.gettur()).ExisteTerritorio(j.getTerrtiorio(i))){
            //Labels.get(i).setIcon();
            Labels.get(i).setVisible(true);
        }
        else Labels.get(i).setVisible(false);
    }
    }
    
    

public void barridoVecinos(Territorio t){
    
    for(int k=0;k<Labels.size();k++){
        Labels.get(k).setVisible(false);
    }
    int numVecinos=t.getNumVecinos();
    for(int i=0;i<numVecinos;i++){
        Labels.get(t.getIdentificador()).setVisible(true);
        //if (j.getjugadores(j.gettur()).ExisteTerritorio(j.getTerrtiorio(i)))
          //  Labels.get(t.IdentVecino(i)).setIcon(bRoja);
           
        Labels.get(t.IdentVecino(i)).setVisible(true);
    }
}

public void ubicarTropasFasePrevia(){
    NOmuestraDados();
    barridoPoseedores();
    jLabelTextoInformacion.removeAll();
    jLabelTextoInfo2.setText("");
    if(idTerritorioOrigen!=-1){
        if(j.getjugadores(j.gettur()).ExisteTerritorio(j.getTerrtiorio(idTerritorioOrigen))){
            if(j.getjugadores(j.gettur()).getTropasPendUbicar()>0)
                /*j.getTerrtiorio(idTerritorioOrigen).setNumTropas(j.getTerrtiorio(idTerritorioOrigen).getNumTropas()+1);
                j.getjugadores(j.gettur()).setTropasPendUbicar(j.getjugadores(j.gettur()).getTropasPendUbicar()-1);*/
                j.ubicar(idTerritorioOrigen);
                j.getturnoFasePrevia();
                jLabelTextoInformacion.setText("Batallón insertado correctamente en "+j.getTerrtiorio(idTerritorioOrigen).getNomTerritorio());
                jLabelTextoInfo2.setText("Te quedan "+ j.getjugadores(j.gettur()).getTropasPendUbicar()+" tropas por ubicar");
                idTerritorioOrigen=-1;
        }
        else{
            jLabelTextoInformacion.setText("Ese territorio no te pertenece");
        }
    }
    else{
        jLabelTextoInformacion.setText("Elije uno de tus territorios");
    }
    if (j.getjugadores(j.gettur()).getTropasPendUbicar()==0){
        jLabelTextoInformacion.setText("No tienes tropas pendientes de ubicar");
        j.getturno();
        faseAtaque=true;
        barridoBotones();
        partidaComenzada=true;
        fasePrevia=false;
        
    }
}

    private void abandono() {
        //j.borrarJugador(j.getjugadores(j.gettur()));
        System.out.println("El numero de jugadores activos es: "+j.getNumJugadores());
        if(j.getNumJugadoresActivos()>2){
            abandono.play();
            j.getjugadores(j.gettur()).setEsActivo(false);
            j.setNumJugadoresActivos(j.getNumJugadoresActivos()-1);
            System.out.println("El numero de jugadores activos tras el abandono es: "+j.getNumJugadores());
            pasarTurno();
        }
        else{
            j.getjugadores(j.gettur()).setEsActivo(false);
            pasarTurno();
            jGanador=new jFrameGanador(j);
            pantallaPrincipal.close();
            aplausos.play();
            victoria.play();
            jGanador.setVisible(true);
            activartablero=false;
            jButtonAtacar.setVisible(false);
            jButtonCanjearCartas.setVisible(false);
            jButtonTransferirTropas.setVisible(false);
            jButtonVerEstado.setVisible(true);
            jButtonAnularSeleccion.setVisible(false);
            jButtonFinalizarTurno.setVisible(false);
            jButtonFinalizarFaseAtaque.setVisible(false);
            jButtonSalir.setVisible(true);
            jButtonGuardarPartida.setVisible(true);
            jButtonInvadir.setVisible(false);
            jButtonAbandonar.setVisible(false);
            //jLabelTextoInformacion.setText("No puedes abandonar, ¡Solo quedas tu!");
            
        }
        
    }

    private void finalizarFaseAtaque() {
        faseAtaque=false;
        barridoBotones();
    }
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButtonAtacar = new javax.swing.JButton();
        jButtonVerEstado = new javax.swing.JButton();
        jButtonCanjearCartas = new javax.swing.JButton();
        jButtonTransferirTropas = new javax.swing.JButton();
        jButtonFinalizarTurno = new javax.swing.JButton();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        jLabelTerritorio0 = new javax.swing.JLabel();
        jLabelTerritorio1 = new javax.swing.JLabel();
        jLabelTerritorio2 = new javax.swing.JLabel();
        jLabelTerritorio3_1 = new javax.swing.JLabel();
        jLabelTerritorio3_2 = new javax.swing.JLabel();
        jLabelTerritorio4 = new javax.swing.JLabel();
        jLabelTerritorio5_1 = new javax.swing.JLabel();
        jLabelTerritorio5_2 = new javax.swing.JLabel();
        jLabelTerritorio6_1 = new javax.swing.JLabel();
        jLabelTerritorio6_2 = new javax.swing.JLabel();
        jLabelTerritorio7 = new javax.swing.JLabel();
        jLabelTerritorio8 = new javax.swing.JLabel();
        jLabelTerritorio9 = new javax.swing.JLabel();
        jLabelTerritorio10 = new javax.swing.JLabel();
        jLabelTerritorio11 = new javax.swing.JLabel();
        jLabelTerritorio12 = new javax.swing.JLabel();
        jLabelTerritorio13 = new javax.swing.JLabel();
        jLabelTerritorio14 = new javax.swing.JLabel();
        jLabelTerritorio15 = new javax.swing.JLabel();
        jLabelTerritorio16 = new javax.swing.JLabel();
        jLabelTerritorio17_1 = new javax.swing.JLabel();
        jLabelTerritorio17_2 = new javax.swing.JLabel();
        jLabelTerritorio18 = new javax.swing.JLabel();
        jLabelTerritorio19 = new javax.swing.JLabel();
        jLabelTerritorio20 = new javax.swing.JLabel();
        jLabelTerritorio21 = new javax.swing.JLabel();
        jLabelTerritorio22 = new javax.swing.JLabel();
        jLabelTerritorio23_1 = new javax.swing.JLabel();
        jLabelTerritorio23_2 = new javax.swing.JLabel();
        jLabelTerritorio24_1 = new javax.swing.JLabel();
        jLabelTerritorio24_2 = new javax.swing.JLabel();
        jLabelTerritorio24_3 = new javax.swing.JLabel();
        jLabelTerritorio25_1 = new javax.swing.JLabel();
        jLabelTerritorio25_2 = new javax.swing.JLabel();
        jLabelTerritorio26_1 = new javax.swing.JLabel();
        jLabelTerritorio26_2 = new javax.swing.JLabel();
        jLabelTerritorio27_1 = new javax.swing.JLabel();
        jLabelTerritorio27_2 = new javax.swing.JLabel();
        jLabelTerritorio28 = new javax.swing.JLabel();
        jLabelTerritorio29 = new javax.swing.JLabel();
        jLabelTerritorio30_1 = new javax.swing.JLabel();
        jLabelTerritorio30_2 = new javax.swing.JLabel();
        jLabelTerritorio31 = new javax.swing.JLabel();
        jLabelTerritorio32 = new javax.swing.JLabel();
        jLabelTerritorio33 = new javax.swing.JLabel();
        jLabelTerritorio34_1 = new javax.swing.JLabel();
        jLabelTerritorio34_2 = new javax.swing.JLabel();
        jLabelTerritorio35 = new javax.swing.JLabel();
        jLabelTerritorio36 = new javax.swing.JLabel();
        jLabelTerritorio37 = new javax.swing.JLabel();
        jLabelTerritorio38 = new javax.swing.JLabel();
        jLabelTerritorio39_1 = new javax.swing.JLabel();
        jLabelTerritorio39_2 = new javax.swing.JLabel();
        jLabelTerritorio40 = new javax.swing.JLabel();
        jLabelTerritorio41 = new javax.swing.JLabel();
        jLabelTerritorio42_1 = new javax.swing.JLabel();
        jLabelTerritorio42_2 = new javax.swing.JLabel();
        jLabelTerritorio43_1 = new javax.swing.JLabel();
        jLabelTerritorio43_2 = new javax.swing.JLabel();
        jLabelTerritorio44_1 = new javax.swing.JLabel();
        jLabelTerritorio44_2 = new javax.swing.JLabel();
        jLabelTerritorio45 = new javax.swing.JLabel();
        jLabelTerritorio46 = new javax.swing.JLabel();
        jLabelTerritorio47_1 = new javax.swing.JLabel();
        jLabelTerritorio47_2 = new javax.swing.JLabel();
        jLabelTerritorio48_1 = new javax.swing.JLabel();
        jLabelTerritorio48_2 = new javax.swing.JLabel();
        jLabelTerritorio49 = new javax.swing.JLabel();
        jLabelTerritorio50_1 = new javax.swing.JLabel();
        jLabelTerritorio50_2 = new javax.swing.JLabel();
        jLabelTerritorio51 = new javax.swing.JLabel();
        jLabelMapa = new javax.swing.JLabel();
        jLabelInformacion = new javax.swing.JLabel();
        jLabelTextoInformacion = new javax.swing.JLabel();
        jLabelOrigen = new javax.swing.JLabel();
        jLabelTextoOrigen = new javax.swing.JLabel();
        jLabelDestino = new javax.swing.JLabel();
        jLabelTextoDestino = new javax.swing.JLabel();
        jLabelTropasOrigen = new javax.swing.JLabel();
        jLabelTropasDestino = new javax.swing.JLabel();
        jLabelTextoTropasOrigen = new javax.swing.JLabel();
        jLabelTextoTropasDestino = new javax.swing.JLabel();
        jLabelTropasImplicadas = new javax.swing.JLabel();
        jButtonAnularSeleccion = new javax.swing.JButton();
        jTextIntroduceInfo = new javax.swing.JTextField();
        jButtonCrearNuevaPartida = new javax.swing.JButton();
        jButtonComenzarPartida = new javax.swing.JButton();
        jButtonFinalizarFaseAtaque = new javax.swing.JButton();
        jButtonSalir = new javax.swing.JButton();
        jLabelJugadorEnTurno = new javax.swing.JLabel();
        jLabelTextoJugadorEnTurno = new javax.swing.JLabel();
        jButtonVerHistorico = new javax.swing.JButton();
        jButtonGuardarPartida = new javax.swing.JButton();
        jLabelTextoInfo2 = new javax.swing.JLabel();
        jButtonInvadir = new javax.swing.JButton();
        jLabelTiradaAtacante = new javax.swing.JLabel();
        jLabelImageDado1Ataca = new javax.swing.JLabel();
        jLabelImageDado2Ataca = new javax.swing.JLabel();
        jLabelImageDado3Ataca = new javax.swing.JLabel();
        jLabelTiradaDefensor = new javax.swing.JLabel();
        jLabelImageDado1Def = new javax.swing.JLabel();
        jLabelImageDado2Def = new javax.swing.JLabel();
        jButtonAbandonar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButtonAtacar.setText("Atacar");
        jButtonAtacar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAtacarActionPerformed(evt);
            }
        });

        jButtonVerEstado.setText("Ver Estado");
        jButtonVerEstado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonVerEstadoActionPerformed(evt);
            }
        });

        jButtonCanjearCartas.setText("Canjear Cartas");
        jButtonCanjearCartas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCanjearCartasActionPerformed(evt);
            }
        });

        jButtonTransferirTropas.setText("Transferir tropas");
        jButtonTransferirTropas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonTransferirTropasActionPerformed(evt);
            }
        });

        jButtonFinalizarTurno.setText("Finalizar Turno");
        jButtonFinalizarTurno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonFinalizarTurnoActionPerformed(evt);
            }
        });

        jLabelTerritorio0.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio0.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio0MouseClicked(evt);
            }
        });
        jLabelTerritorio0.setBounds(50, 430, 110, 50);
        jLayeredPane1.add(jLabelTerritorio0, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio1MouseClicked(evt);
            }
        });
        jLabelTerritorio1.setBounds(170, 380, 70, 100);
        jLayeredPane1.add(jLabelTerritorio1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio2MouseClicked(evt);
            }
        });
        jLabelTerritorio2.setBounds(50, 390, 110, 40);
        jLayeredPane1.add(jLabelTerritorio2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio3_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio3_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio3_1MouseClicked(evt);
            }
        });
        jLabelTerritorio3_1.setBounds(30, 330, 90, 50);
        jLayeredPane1.add(jLabelTerritorio3_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio3_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio3_2MouseClicked(evt);
            }
        });
        jLabelTerritorio3_2.setBounds(80, 310, 50, 20);
        jLayeredPane1.add(jLabelTerritorio3_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio4MouseClicked(evt);
            }
        });
        jLabelTerritorio4.setBounds(130, 320, 50, 60);
        jLayeredPane1.add(jLabelTerritorio4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio5_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio5_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio5_1MouseClicked(evt);
            }
        });
        jLabelTerritorio5_1.setBounds(50, 290, 70, 30);
        jLayeredPane1.add(jLabelTerritorio5_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio5_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio5_2MouseClicked(evt);
            }
        });
        jLabelTerritorio5_2.setBounds(10, 320, 50, 10);
        jLayeredPane1.add(jLabelTerritorio5_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio6_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio6_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio6_1MouseClicked(evt);
            }
        });
        jLabelTerritorio6_1.setBounds(140, 250, 40, 50);
        jLayeredPane1.add(jLabelTerritorio6_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio6_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio6_2MouseClicked(evt);
            }
        });
        jLabelTerritorio6_2.setBounds(180, 300, 60, 30);
        jLayeredPane1.add(jLabelTerritorio6_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio7.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio7MouseClicked(evt);
            }
        });
        jLabelTerritorio7.setBounds(80, 240, 60, 40);
        jLayeredPane1.add(jLabelTerritorio7, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio8.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio8MouseClicked(evt);
            }
        });
        jLabelTerritorio8.setBounds(100, 190, 60, 40);
        jLayeredPane1.add(jLabelTerritorio8, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio9.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio9MouseClicked(evt);
            }
        });
        jLabelTerritorio9.setBounds(160, 180, 60, 50);
        jLayeredPane1.add(jLabelTerritorio9, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio10.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio10MouseClicked(evt);
            }
        });
        jLabelTerritorio10.setBounds(220, 180, 40, 50);
        jLayeredPane1.add(jLabelTerritorio10, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio11.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio11MouseClicked(evt);
            }
        });
        jLabelTerritorio11.setBounds(104, 134, 50, 50);
        jLayeredPane1.add(jLabelTerritorio11, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio12.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio12MouseClicked(evt);
            }
        });
        jLabelTerritorio12.setBounds(160, 124, 50, 60);
        jLayeredPane1.add(jLabelTerritorio12, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio13.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio13MouseClicked(evt);
            }
        });
        jLabelTerritorio13.setBounds(220, 124, 50, 60);
        jLayeredPane1.add(jLabelTerritorio13, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio14.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio14MouseClicked(evt);
            }
        });
        jLabelTerritorio14.setBounds(140, 80, 60, 50);
        jLayeredPane1.add(jLabelTerritorio14, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio15.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio15MouseClicked(evt);
            }
        });
        jLabelTerritorio15.setBounds(200, 80, 70, 40);
        jLayeredPane1.add(jLabelTerritorio15, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio16.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio16.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio16MouseClicked(evt);
            }
        });
        jLabelTerritorio16.setBounds(150, 20, 110, 50);
        jLayeredPane1.add(jLabelTerritorio16, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio17_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio17_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio17_1MouseClicked(evt);
            }
        });
        jLabelTerritorio17_1.setBounds(290, 40, 50, 70);
        jLayeredPane1.add(jLabelTerritorio17_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio17_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio17_2MouseClicked(evt);
            }
        });
        jLabelTerritorio17_2.setBounds(350, 50, 40, 40);
        jLayeredPane1.add(jLabelTerritorio17_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio18.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio18.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio18MouseClicked(evt);
            }
        });
        jLabelTerritorio18.setBounds(280, 120, 70, 40);
        jLayeredPane1.add(jLabelTerritorio18, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio19.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio19.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio19MouseClicked(evt);
            }
        });
        jLabelTerritorio19.setBounds(350, 100, 70, 60);
        jLayeredPane1.add(jLabelTerritorio19, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio20.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio20.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio20MouseClicked(evt);
            }
        });
        jLabelTerritorio20.setBounds(270, 170, 60, 100);
        jLayeredPane1.add(jLabelTerritorio20, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio21.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio21MouseClicked(evt);
            }
        });
        jLabelTerritorio21.setBounds(330, 170, 50, 90);
        jLayeredPane1.add(jLabelTerritorio21, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio22.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio22.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio22MouseClicked(evt);
            }
        });
        jLabelTerritorio22.setBounds(390, 170, 40, 90);
        jLayeredPane1.add(jLabelTerritorio22, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio23_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio23_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio23_1MouseClicked(evt);
            }
        });
        jLabelTerritorio23_1.setBounds(260, 270, 80, 30);
        jLayeredPane1.add(jLabelTerritorio23_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio23_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio23_2MouseClicked(evt);
            }
        });
        jLabelTerritorio23_2.setBounds(260, 300, 40, 50);
        jLayeredPane1.add(jLabelTerritorio23_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio24_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio24_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio24_1MouseClicked(evt);
            }
        });
        jLabelTerritorio24_1.setBounds(300, 330, 60, 60);
        jLayeredPane1.add(jLabelTerritorio24_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio24_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio24_2MouseClicked(evt);
            }
        });
        jLabelTerritorio24_2.setBounds(324, 294, 30, 30);
        jLayeredPane1.add(jLabelTerritorio24_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio24_3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio24_3MouseClicked(evt);
            }
        });
        jLabelTerritorio24_3.setBounds(260, 360, 50, 40);
        jLayeredPane1.add(jLabelTerritorio24_3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio25_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio25_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio25_1MouseClicked(evt);
            }
        });
        jLabelTerritorio25_1.setBounds(360, 320, 60, 60);
        jLayeredPane1.add(jLabelTerritorio25_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio25_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio25_2MouseClicked(evt);
            }
        });
        jLabelTerritorio25_2.setBounds(360, 290, 30, 30);
        jLayeredPane1.add(jLabelTerritorio25_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio26_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio26_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio26_1MouseClicked(evt);
            }
        });
        jLabelTerritorio26_1.setBounds(380, 270, 50, 30);
        jLayeredPane1.add(jLabelTerritorio26_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio26_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio26_2MouseClicked(evt);
            }
        });
        jLabelTerritorio26_2.setBounds(400, 300, 40, 20);
        jLayeredPane1.add(jLabelTerritorio26_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio27_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio27_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio27_1MouseClicked(evt);
            }
        });
        jLabelTerritorio27_1.setBounds(280, 400, 80, 30);
        jLayeredPane1.add(jLabelTerritorio27_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio27_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio27_2MouseClicked(evt);
            }
        });
        jLabelTerritorio27_2.setBounds(320, 440, 30, 40);
        jLayeredPane1.add(jLabelTerritorio27_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio28.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio28.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio28MouseClicked(evt);
            }
        });
        jLabelTerritorio28.setBounds(360, 380, 60, 80);
        jLayeredPane1.add(jLabelTerritorio28, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio29.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio29.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio29MouseClicked(evt);
            }
        });
        jLabelTerritorio29.setBounds(420, 360, 40, 110);
        jLayeredPane1.add(jLabelTerritorio29, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio30_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio30_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio30_1MouseClicked(evt);
            }
        });
        jLabelTerritorio30_1.setBounds(350, 480, 100, 50);
        jLayeredPane1.add(jLabelTerritorio30_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio30_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio30_2MouseClicked(evt);
            }
        });
        jLabelTerritorio30_2.setBounds(380, 460, 50, 20);
        jLayeredPane1.add(jLabelTerritorio30_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio31.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio31.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio31MouseClicked(evt);
            }
        });
        jLabelTerritorio31.setBounds(270, 470, 40, 70);
        jLayeredPane1.add(jLabelTerritorio31, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio32.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio32.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio32MouseClicked(evt);
            }
        });
        jLabelTerritorio32.setBounds(470, 170, 40, 90);
        jLayeredPane1.add(jLabelTerritorio32, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio33.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio33.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio33MouseClicked(evt);
            }
        });
        jLabelTerritorio33.setBounds(460, 290, 30, 80);
        jLayeredPane1.add(jLabelTerritorio33, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio34_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio34_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio34_1MouseClicked(evt);
            }
        });
        jLabelTerritorio34_1.setBounds(440, 0, 100, 50);
        jLayeredPane1.add(jLabelTerritorio34_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio34_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio34_2MouseClicked(evt);
            }
        });
        jLabelTerritorio34_2.setBounds(430, 60, 60, 20);
        jLayeredPane1.add(jLabelTerritorio34_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio35.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio35.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio35MouseClicked(evt);
            }
        });
        jLabelTerritorio35.setBounds(440, 90, 70, 60);
        jLayeredPane1.add(jLabelTerritorio35, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio36.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio36.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio36MouseClicked(evt);
            }
        });
        jLabelTerritorio36.setBounds(514, 50, 50, 90);
        jLayeredPane1.add(jLabelTerritorio36, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio37.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio37.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio37MouseClicked(evt);
            }
        });
        jLabelTerritorio37.setBounds(560, 0, 100, 130);
        jLayeredPane1.add(jLabelTerritorio37, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio38.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio38.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio38MouseClicked(evt);
            }
        });
        jLabelTerritorio38.setBounds(540, 170, 40, 50);
        jLayeredPane1.add(jLabelTerritorio38, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio39_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio39_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio39_1MouseClicked(evt);
            }
        });
        jLabelTerritorio39_1.setBounds(590, 220, 70, 30);
        jLayeredPane1.add(jLabelTerritorio39_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio39_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio39_2MouseClicked(evt);
            }
        });
        jLabelTerritorio39_2.setBounds(590, 170, 30, 50);
        jLayeredPane1.add(jLabelTerritorio39_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio40.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio40.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio40MouseClicked(evt);
            }
        });
        jLabelTerritorio40.setBounds(630, 160, 130, 70);
        jLayeredPane1.add(jLabelTerritorio40, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio41.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio41.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio41MouseClicked(evt);
            }
        });
        jLabelTerritorio41.setBounds(760, 210, 120, 70);
        jLayeredPane1.add(jLabelTerritorio41, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio42_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio42_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio42_1MouseClicked(evt);
            }
        });
        jLabelTerritorio42_1.setBounds(530, 240, 60, 40);
        jLayeredPane1.add(jLabelTerritorio42_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio42_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio42_2MouseClicked(evt);
            }
        });
        jLabelTerritorio42_2.setBounds(520, 290, 50, 40);
        jLayeredPane1.add(jLabelTerritorio42_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio43_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio43_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio43_1MouseClicked(evt);
            }
        });
        jLabelTerritorio43_1.setBounds(600, 270, 60, 40);
        jLayeredPane1.add(jLabelTerritorio43_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio43_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio43_2MouseClicked(evt);
            }
        });
        jLabelTerritorio43_2.setBounds(660, 320, 40, 50);
        jLayeredPane1.add(jLabelTerritorio43_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio44_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio44_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio44_1MouseClicked(evt);
            }
        });
        jLabelTerritorio44_1.setBounds(680, 250, 80, 50);
        jLayeredPane1.add(jLabelTerritorio44_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio44_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio44_2MouseClicked(evt);
            }
        });
        jLabelTerritorio44_2.setBounds(710, 300, 60, 60);
        jLayeredPane1.add(jLabelTerritorio44_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio45.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio45.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio45MouseClicked(evt);
            }
        });
        jLabelTerritorio45.setBounds(770, 290, 110, 90);
        jLayeredPane1.add(jLabelTerritorio45, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio46.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio46.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio46MouseClicked(evt);
            }
        });
        jLabelTerritorio46.setBounds(500, 330, 40, 50);
        jLayeredPane1.add(jLabelTerritorio46, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio47_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio47_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio47_1MouseClicked(evt);
            }
        });
        jLabelTerritorio47_1.setBounds(600, 330, 60, 30);
        jLayeredPane1.add(jLabelTerritorio47_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio47_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio47_2MouseClicked(evt);
            }
        });
        jLabelTerritorio47_2.setBounds(580, 310, 50, 20);
        jLayeredPane1.add(jLabelTerritorio47_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio48_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio48_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio48_1MouseClicked(evt);
            }
        });
        jLabelTerritorio48_1.setBounds(545, 340, 40, 70);
        jLayeredPane1.add(jLabelTerritorio48_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio48_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio48_2MouseClicked(evt);
            }
        });
        jLabelTerritorio48_2.setBounds(530, 370, 30, 90);
        jLayeredPane1.add(jLabelTerritorio48_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio49.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio49.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio49MouseClicked(evt);
            }
        });
        jLabelTerritorio49.setBounds(590, 380, 70, 60);
        jLayeredPane1.add(jLabelTerritorio49, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio50_1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio50_1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio50_1MouseClicked(evt);
            }
        });
        jLabelTerritorio50_1.setBounds(550, 460, 80, 50);
        jLayeredPane1.add(jLabelTerritorio50_1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio50_2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio50_2MouseClicked(evt);
            }
        });
        jLabelTerritorio50_2.setBounds(560, 440, 50, 20);
        jLayeredPane1.add(jLabelTerritorio50_2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelTerritorio51.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTerritorio51.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelTerritorio51MouseClicked(evt);
            }
        });
        jLabelTerritorio51.setBounds(180, 240, 60, 50);
        jLayeredPane1.add(jLabelTerritorio51, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelMapa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/urban-risk-nombres.JPG"))); // NOI18N
        jLabelMapa.setText("jLabel1");
        jLabelMapa.setBounds(-10, -30, 910, 690);
        jLayeredPane1.add(jLabelMapa, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabelInformacion.setText("Información:");

        jLabelOrigen.setText("Origen: ");

        jLabelDestino.setText("Destino: ");

        jLabelTropasOrigen.setText("Tropas:");

        jLabelTropasDestino.setText("Tropas:");

        jLabelTropasImplicadas.setText("Entrada de información:");

        jButtonAnularSeleccion.setText("Anular Selección");
        jButtonAnularSeleccion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAnularSeleccionActionPerformed(evt);
            }
        });

        jButtonCrearNuevaPartida.setText("Crear Nueva Partida");
        jButtonCrearNuevaPartida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCrearNuevaPartidaActionPerformed(evt);
            }
        });

        jButtonComenzarPartida.setText("Comenzar Partida");
        jButtonComenzarPartida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonComenzarPartidaActionPerformed(evt);
            }
        });

        jButtonFinalizarFaseAtaque.setText("Finalizar Fase de Ataque");
        jButtonFinalizarFaseAtaque.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonFinalizarFaseAtaqueActionPerformed(evt);
            }
        });

        jButtonSalir.setText("Salir");
        jButtonSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSalirActionPerformed(evt);
            }
        });

        jLabelJugadorEnTurno.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabelJugadorEnTurno.setText("TURNO DEL JUGADOR: ");

        jButtonVerHistorico.setText("Ver Histórico");
        jButtonVerHistorico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonVerHistoricoActionPerformed(evt);
            }
        });

        jButtonGuardarPartida.setText("Guardar Partida");
        jButtonGuardarPartida.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonGuardarPartidaActionPerformed(evt);
            }
        });

        jButtonInvadir.setText("Invadir");
        jButtonInvadir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonInvadirActionPerformed(evt);
            }
        });

        jLabelTiradaAtacante.setText("Tirada Atacante");

        jLabelImageDado1Ataca.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        jLabelImageDado2Ataca.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

        jLabelImageDado3Ataca.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        jLabelTiradaDefensor.setText("Tirada Defensor");

        jButtonAbandonar.setText("Abandonar");
        jButtonAbandonar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAbandonarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 888, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelTiradaAtacante)
                            .addComponent(jButtonSalir)
                            .addComponent(jButtonAbandonar)
                            .addComponent(jButtonInvadir)
                            .addComponent(jButtonFinalizarFaseAtaque)
                            .addComponent(jButtonFinalizarTurno)
                            .addComponent(jButtonAnularSeleccion)
                            .addComponent(jButtonTransferirTropas)
                            .addComponent(jButtonCanjearCartas)
                            .addComponent(jButtonVerEstado)
                            .addComponent(jButtonAtacar)
                            .addComponent(jButtonComenzarPartida)
                            .addComponent(jButtonGuardarPartida)
                            .addComponent(jButtonVerHistorico)
                            .addComponent(jLabelTiradaDefensor)
                            .addComponent(jButtonCrearNuevaPartida)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                    .addComponent(jLabelImageDado1Def, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabelImageDado2Def, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(jLabelImageDado1Ataca, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabelImageDado3Ataca, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE))
                                    .addGap(18, 18, 18)
                                    .addComponent(jLabelImageDado2Ataca, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(111, 111, 111)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelTropasImplicadas)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabelTropasOrigen)
                                    .addComponent(jLabelOrigen))
                                .addGap(101, 101, 101)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(10, 10, 10)
                                        .addComponent(jTextIntroduceInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jLabelTextoTropasOrigen, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabelTextoOrigen, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(89, 89, 89)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabelTropasDestino)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabelTextoTropasDestino, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabelDestino)
                                        .addGap(34, 34, 34)
                                        .addComponent(jLabelTextoDestino, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabelInformacion)
                                        .addGap(28, 28, 28)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabelTextoInfo2, javax.swing.GroupLayout.PREFERRED_SIZE, 439, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabelTextoInformacion, javax.swing.GroupLayout.PREFERRED_SIZE, 474, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabelJugadorEnTurno)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabelTextoJugadorEnTurno, javax.swing.GroupLayout.PREFERRED_SIZE, 372, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jButtonCrearNuevaPartida)
                        .addGap(1, 1, 1)
                        .addComponent(jButtonVerHistorico)
                        .addGap(4, 4, 4)
                        .addComponent(jButtonGuardarPartida)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonComenzarPartida)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonAtacar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonVerEstado)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonCanjearCartas)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonTransferirTropas)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonAnularSeleccion)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonFinalizarTurno)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonFinalizarFaseAtaque)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonInvadir)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonAbandonar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonSalir)
                        .addGap(5, 5, 5)
                        .addComponent(jLabelTiradaAtacante)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelImageDado2Ataca, javax.swing.GroupLayout.DEFAULT_SIZE, 4, Short.MAX_VALUE)
                            .addComponent(jLabelImageDado1Ataca, javax.swing.GroupLayout.DEFAULT_SIZE, 4, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelImageDado3Ataca, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelTiradaDefensor)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabelImageDado2Def, javax.swing.GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE)
                            .addComponent(jLabelImageDado1Def, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLayeredPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE))
                .addGap(82, 82, 82)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabelJugadorEnTurno)
                    .addComponent(jLabelTextoJugadorEnTurno, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelOrigen)
                    .addComponent(jLabelTextoOrigen, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelDestino)
                    .addComponent(jLabelTextoDestino, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelTextoTropasDestino, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelTropasDestino)
                    .addComponent(jLabelTextoTropasOrigen, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelTropasOrigen))
                .addGap(3, 3, 3)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelTropasImplicadas)
                            .addComponent(jTextIntroduceInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabelInformacion))
                        .addGap(67, 67, 67))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jLabelTextoInformacion, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelTextoInfo2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );

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

private void jButtonCanjearCartasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCanjearCartasActionPerformed
    canjear();
}//GEN-LAST:event_jButtonCanjearCartasActionPerformed

private void jButtonAtacarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAtacarActionPerformed
    
    lanzarAtaque();
    
}//GEN-LAST:event_jButtonAtacarActionPerformed

private void jLabelTerritorio0MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio0MouseClicked
    asignaTerritorioClickado(0);
}//GEN-LAST:event_jLabelTerritorio0MouseClicked

private void jLabelTerritorio1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio1MouseClicked
    asignaTerritorioClickado(1);
}//GEN-LAST:event_jLabelTerritorio1MouseClicked

private void jButtonAnularSeleccionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAnularSeleccionActionPerformed
    anularSeleccion();
    // TODO add your handling code here:
}//GEN-LAST:event_jButtonAnularSeleccionActionPerformed



private void jButtonCrearNuevaPartidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCrearNuevaPartidaActionPerformed
    jfrmI.setVisible(true);
}//GEN-LAST:event_jButtonCrearNuevaPartidaActionPerformed

private void jButtonComenzarPartidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonComenzarPartidaActionPerformed
   
    comenzarPartida();
    
    //j.fasePrevia();
}//GEN-LAST:event_jButtonComenzarPartidaActionPerformed

private void jLabelTerritorio9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio9MouseClicked
   asignaTerritorioClickado(9);
}//GEN-LAST:event_jLabelTerritorio9MouseClicked

private void jLabelTerritorio10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio10MouseClicked
    asignaTerritorioClickado(10);
}//GEN-LAST:event_jLabelTerritorio10MouseClicked

private void jLabelTerritorio11MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio11MouseClicked
    asignaTerritorioClickado(11);
}//GEN-LAST:event_jLabelTerritorio11MouseClicked

private void jLabelTerritorio12MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio12MouseClicked
    asignaTerritorioClickado(12);
}//GEN-LAST:event_jLabelTerritorio12MouseClicked

private void jLabelTerritorio13MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio13MouseClicked
    asignaTerritorioClickado(13);
}//GEN-LAST:event_jLabelTerritorio13MouseClicked

private void jLabelTerritorio14MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio14MouseClicked
    asignaTerritorioClickado(14);
}//GEN-LAST:event_jLabelTerritorio14MouseClicked

private void jLabelTerritorio15MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio15MouseClicked
    asignaTerritorioClickado(15);
}//GEN-LAST:event_jLabelTerritorio15MouseClicked

private void jLabelTerritorio16MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio16MouseClicked
    asignaTerritorioClickado(16);
}//GEN-LAST:event_jLabelTerritorio16MouseClicked

private void jLabelTerritorio17_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio17_1MouseClicked
    asignaTerritorioClickado(17);
}//GEN-LAST:event_jLabelTerritorio17_1MouseClicked

private void jLabelTerritorio17_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio17_2MouseClicked
    asignaTerritorioClickado(17);
}//GEN-LAST:event_jLabelTerritorio17_2MouseClicked

private void jLabelTerritorio18MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio18MouseClicked
    asignaTerritorioClickado(18);
}//GEN-LAST:event_jLabelTerritorio18MouseClicked

private void jLabelTerritorio19MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio19MouseClicked
    asignaTerritorioClickado(19);
}//GEN-LAST:event_jLabelTerritorio19MouseClicked

private void jLabelTerritorio20MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio20MouseClicked
    asignaTerritorioClickado(20);
}//GEN-LAST:event_jLabelTerritorio20MouseClicked

private void jLabelTerritorio21MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio21MouseClicked
    asignaTerritorioClickado(21);
}//GEN-LAST:event_jLabelTerritorio21MouseClicked

private void jLabelTerritorio22MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio22MouseClicked
    asignaTerritorioClickado(22);
}//GEN-LAST:event_jLabelTerritorio22MouseClicked

private void jLabelTerritorio23_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio23_1MouseClicked
    asignaTerritorioClickado(23);
}//GEN-LAST:event_jLabelTerritorio23_1MouseClicked

private void jLabelTerritorio23_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio23_2MouseClicked
   asignaTerritorioClickado(23);
}//GEN-LAST:event_jLabelTerritorio23_2MouseClicked

private void jLabelTerritorio24_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio24_1MouseClicked
    asignaTerritorioClickado(24);
}//GEN-LAST:event_jLabelTerritorio24_1MouseClicked

private void jLabelTerritorio24_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio24_2MouseClicked
    asignaTerritorioClickado(24);
}//GEN-LAST:event_jLabelTerritorio24_2MouseClicked

private void jLabelTerritorio24_3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio24_3MouseClicked
    asignaTerritorioClickado(24);
}//GEN-LAST:event_jLabelTerritorio24_3MouseClicked

private void jLabelTerritorio25_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio25_1MouseClicked
    asignaTerritorioClickado(25);
}//GEN-LAST:event_jLabelTerritorio25_1MouseClicked

private void jLabelTerritorio25_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio25_2MouseClicked
    asignaTerritorioClickado(25);
}//GEN-LAST:event_jLabelTerritorio25_2MouseClicked

private void jLabelTerritorio26_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio26_1MouseClicked
    asignaTerritorioClickado(26);
}//GEN-LAST:event_jLabelTerritorio26_1MouseClicked

private void jLabelTerritorio26_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio26_2MouseClicked
    asignaTerritorioClickado(26);
}//GEN-LAST:event_jLabelTerritorio26_2MouseClicked

private void jLabelTerritorio27_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio27_1MouseClicked
    asignaTerritorioClickado(27);
}//GEN-LAST:event_jLabelTerritorio27_1MouseClicked

private void jLabelTerritorio27_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio27_2MouseClicked
    asignaTerritorioClickado(27);
}//GEN-LAST:event_jLabelTerritorio27_2MouseClicked

private void jLabelTerritorio28MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio28MouseClicked
    asignaTerritorioClickado(28);
}//GEN-LAST:event_jLabelTerritorio28MouseClicked

private void jLabelTerritorio29MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio29MouseClicked
    asignaTerritorioClickado(29);
}//GEN-LAST:event_jLabelTerritorio29MouseClicked

private void jLabelTerritorio30_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio30_1MouseClicked
    asignaTerritorioClickado(30);
}//GEN-LAST:event_jLabelTerritorio30_1MouseClicked

private void jLabelTerritorio30_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio30_2MouseClicked
    asignaTerritorioClickado(30);
}//GEN-LAST:event_jLabelTerritorio30_2MouseClicked

private void jLabelTerritorio31MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio31MouseClicked
    asignaTerritorioClickado(31);
}//GEN-LAST:event_jLabelTerritorio31MouseClicked

private void jLabelTerritorio32MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio32MouseClicked
    asignaTerritorioClickado(32);
}//GEN-LAST:event_jLabelTerritorio32MouseClicked

private void jLabelTerritorio33MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio33MouseClicked
    asignaTerritorioClickado(33);
}//GEN-LAST:event_jLabelTerritorio33MouseClicked

private void jLabelTerritorio2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio2MouseClicked
    asignaTerritorioClickado(2);
}//GEN-LAST:event_jLabelTerritorio2MouseClicked

private void jLabelTerritorio4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio4MouseClicked
    asignaTerritorioClickado(4);
}//GEN-LAST:event_jLabelTerritorio4MouseClicked

private void jLabelTerritorio3_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio3_1MouseClicked
    asignaTerritorioClickado(3);
}//GEN-LAST:event_jLabelTerritorio3_1MouseClicked

private void jLabelTerritorio5_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio5_1MouseClicked
    asignaTerritorioClickado(5);
}//GEN-LAST:event_jLabelTerritorio5_1MouseClicked

private void jLabelTerritorio5_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio5_2MouseClicked
    asignaTerritorioClickado(5);
}//GEN-LAST:event_jLabelTerritorio5_2MouseClicked

private void jLabelTerritorio6_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio6_1MouseClicked
    asignaTerritorioClickado(6);
}//GEN-LAST:event_jLabelTerritorio6_1MouseClicked

private void jLabelTerritorio6_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio6_2MouseClicked
    asignaTerritorioClickado(6);
}//GEN-LAST:event_jLabelTerritorio6_2MouseClicked

private void jLabelTerritorio7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio7MouseClicked
    asignaTerritorioClickado(7);
}//GEN-LAST:event_jLabelTerritorio7MouseClicked

private void jLabelTerritorio8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio8MouseClicked
    asignaTerritorioClickado(8);
}//GEN-LAST:event_jLabelTerritorio8MouseClicked

private void jLabelTerritorio3_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio3_2MouseClicked
    asignaTerritorioClickado(3);
}//GEN-LAST:event_jLabelTerritorio3_2MouseClicked

private void jButtonFinalizarFaseAtaqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFinalizarFaseAtaqueActionPerformed
    
    finalizarFaseAtaque();
    
}//GEN-LAST:event_jButtonFinalizarFaseAtaqueActionPerformed

private void jButtonSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSalirActionPerformed
    this.dispose();
    System.exit(0);
}//GEN-LAST:event_jButtonSalirActionPerformed

private void jButtonFinalizarTurnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFinalizarTurnoActionPerformed
    pantallaPrincipal.close();
    pasarTurno();
    pantallaPrincipal.play();
}//GEN-LAST:event_jButtonFinalizarTurnoActionPerformed

private void jLabelTerritorio34_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio34_1MouseClicked
asignaTerritorioClickado(34);
}//GEN-LAST:event_jLabelTerritorio34_1MouseClicked

private void jLabelTerritorio34_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio34_2MouseClicked
    asignaTerritorioClickado(34);
}//GEN-LAST:event_jLabelTerritorio34_2MouseClicked

private void jLabelTerritorio35MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio35MouseClicked
    asignaTerritorioClickado(35);
}//GEN-LAST:event_jLabelTerritorio35MouseClicked

private void jLabelTerritorio36MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio36MouseClicked
    asignaTerritorioClickado(36);
}//GEN-LAST:event_jLabelTerritorio36MouseClicked

private void jLabelTerritorio37MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio37MouseClicked
    asignaTerritorioClickado(37);
}//GEN-LAST:event_jLabelTerritorio37MouseClicked

private void jLabelTerritorio38MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio38MouseClicked
    asignaTerritorioClickado(38);
}//GEN-LAST:event_jLabelTerritorio38MouseClicked

private void jLabelTerritorio39_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio39_1MouseClicked
    asignaTerritorioClickado(39);
}//GEN-LAST:event_jLabelTerritorio39_1MouseClicked

private void jLabelTerritorio39_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio39_2MouseClicked
    asignaTerritorioClickado(39);
}//GEN-LAST:event_jLabelTerritorio39_2MouseClicked

private void jLabelTerritorio40MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio40MouseClicked
    asignaTerritorioClickado(40);
}//GEN-LAST:event_jLabelTerritorio40MouseClicked

private void jLabelTerritorio41MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio41MouseClicked
    asignaTerritorioClickado(41);
}//GEN-LAST:event_jLabelTerritorio41MouseClicked

private void jLabelTerritorio42_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio42_1MouseClicked
    asignaTerritorioClickado(42);
}//GEN-LAST:event_jLabelTerritorio42_1MouseClicked

private void jLabelTerritorio42_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio42_2MouseClicked
    asignaTerritorioClickado(42);
}//GEN-LAST:event_jLabelTerritorio42_2MouseClicked

private void jLabelTerritorio43_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio43_1MouseClicked
asignaTerritorioClickado(43);
}//GEN-LAST:event_jLabelTerritorio43_1MouseClicked

private void jLabelTerritorio43_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio43_2MouseClicked
asignaTerritorioClickado(43);
}//GEN-LAST:event_jLabelTerritorio43_2MouseClicked

private void jLabelTerritorio44_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio44_1MouseClicked
asignaTerritorioClickado(44);
}//GEN-LAST:event_jLabelTerritorio44_1MouseClicked

private void jLabelTerritorio44_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio44_2MouseClicked
asignaTerritorioClickado(44);
}//GEN-LAST:event_jLabelTerritorio44_2MouseClicked

private void jLabelTerritorio45MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio45MouseClicked
asignaTerritorioClickado(45);
}//GEN-LAST:event_jLabelTerritorio45MouseClicked

private void jLabelTerritorio46MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio46MouseClicked
asignaTerritorioClickado(46);
}//GEN-LAST:event_jLabelTerritorio46MouseClicked

private void jLabelTerritorio47_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio47_1MouseClicked
asignaTerritorioClickado(47);
}//GEN-LAST:event_jLabelTerritorio47_1MouseClicked

private void jLabelTerritorio47_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio47_2MouseClicked
asignaTerritorioClickado(47);
}//GEN-LAST:event_jLabelTerritorio47_2MouseClicked

private void jLabelTerritorio48_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio48_1MouseClicked
asignaTerritorioClickado(48);
}//GEN-LAST:event_jLabelTerritorio48_1MouseClicked

private void jLabelTerritorio48_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio48_2MouseClicked
asignaTerritorioClickado(48);
}//GEN-LAST:event_jLabelTerritorio48_2MouseClicked

private void jLabelTerritorio49MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio49MouseClicked
asignaTerritorioClickado(49);
}//GEN-LAST:event_jLabelTerritorio49MouseClicked

private void jLabelTerritorio50_1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio50_1MouseClicked
asignaTerritorioClickado(50);
}//GEN-LAST:event_jLabelTerritorio50_1MouseClicked

private void jLabelTerritorio50_2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio50_2MouseClicked
asignaTerritorioClickado(50);
}//GEN-LAST:event_jLabelTerritorio50_2MouseClicked

private void jLabelTerritorio51MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelTerritorio51MouseClicked
asignaTerritorioClickado(51);
}//GEN-LAST:event_jLabelTerritorio51MouseClicked

private void jButtonGuardarPartidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarPartidaActionPerformed
    ControladorBD.persist(j);// TODO add your handling code here:
}//GEN-LAST:event_jButtonGuardarPartidaActionPerformed

private void jButtonTransferirTropasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonTransferirTropasActionPerformed
    transferir();// TODO add your handling code here:
    
}//GEN-LAST:event_jButtonTransferirTropasActionPerformed

private void jButtonInvadirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonInvadirActionPerformed
    lanzarInvasion();
}//GEN-LAST:event_jButtonInvadirActionPerformed

private void jButtonVerEstadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVerEstadoActionPerformed
    jVerEstad.setVisible(true);
    jVerEstad.lanzarVerEstado();
}//GEN-LAST:event_jButtonVerEstadoActionPerformed

private void jButtonVerHistoricoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVerHistoricoActionPerformed
    jfrmCP=new jfrmCargarPartida(j);
    jfrmCP.setVisible(true);
}//GEN-LAST:event_jButtonVerHistoricoActionPerformed

private void jButtonAbandonarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAbandonarActionPerformed
    abandono();
}//GEN-LAST:event_jButtonAbandonarActionPerformed

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

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonAbandonar;
    private javax.swing.JButton jButtonAnularSeleccion;
    private javax.swing.JButton jButtonAtacar;
    private javax.swing.JButton jButtonCanjearCartas;
    private javax.swing.JButton jButtonComenzarPartida;
    private javax.swing.JButton jButtonCrearNuevaPartida;
    private javax.swing.JButton jButtonFinalizarFaseAtaque;
    private javax.swing.JButton jButtonFinalizarTurno;
    private javax.swing.JButton jButtonGuardarPartida;
    private javax.swing.JButton jButtonInvadir;
    private javax.swing.JButton jButtonSalir;
    private javax.swing.JButton jButtonTransferirTropas;
    private javax.swing.JButton jButtonVerEstado;
    private javax.swing.JButton jButtonVerHistorico;
    private javax.swing.JLabel jLabelDestino;
    private javax.swing.JLabel jLabelImageDado1Ataca;
    private javax.swing.JLabel jLabelImageDado1Def;
    private javax.swing.JLabel jLabelImageDado2Ataca;
    private javax.swing.JLabel jLabelImageDado2Def;
    private javax.swing.JLabel jLabelImageDado3Ataca;
    private javax.swing.JLabel jLabelInformacion;
    private javax.swing.JLabel jLabelJugadorEnTurno;
    private javax.swing.JLabel jLabelMapa;
    private javax.swing.JLabel jLabelOrigen;
    private javax.swing.JLabel jLabelTerritorio0;
    private javax.swing.JLabel jLabelTerritorio1;
    private javax.swing.JLabel jLabelTerritorio10;
    private javax.swing.JLabel jLabelTerritorio11;
    private javax.swing.JLabel jLabelTerritorio12;
    private javax.swing.JLabel jLabelTerritorio13;
    private javax.swing.JLabel jLabelTerritorio14;
    private javax.swing.JLabel jLabelTerritorio15;
    private javax.swing.JLabel jLabelTerritorio16;
    private javax.swing.JLabel jLabelTerritorio17_1;
    private javax.swing.JLabel jLabelTerritorio17_2;
    private javax.swing.JLabel jLabelTerritorio18;
    private javax.swing.JLabel jLabelTerritorio19;
    private javax.swing.JLabel jLabelTerritorio2;
    private javax.swing.JLabel jLabelTerritorio20;
    private javax.swing.JLabel jLabelTerritorio21;
    private javax.swing.JLabel jLabelTerritorio22;
    private javax.swing.JLabel jLabelTerritorio23_1;
    private javax.swing.JLabel jLabelTerritorio23_2;
    private javax.swing.JLabel jLabelTerritorio24_1;
    private javax.swing.JLabel jLabelTerritorio24_2;
    private javax.swing.JLabel jLabelTerritorio24_3;
    private javax.swing.JLabel jLabelTerritorio25_1;
    private javax.swing.JLabel jLabelTerritorio25_2;
    private javax.swing.JLabel jLabelTerritorio26_1;
    private javax.swing.JLabel jLabelTerritorio26_2;
    private javax.swing.JLabel jLabelTerritorio27_1;
    private javax.swing.JLabel jLabelTerritorio27_2;
    private javax.swing.JLabel jLabelTerritorio28;
    private javax.swing.JLabel jLabelTerritorio29;
    private javax.swing.JLabel jLabelTerritorio30_1;
    private javax.swing.JLabel jLabelTerritorio30_2;
    private javax.swing.JLabel jLabelTerritorio31;
    private javax.swing.JLabel jLabelTerritorio32;
    private javax.swing.JLabel jLabelTerritorio33;
    private javax.swing.JLabel jLabelTerritorio34_1;
    private javax.swing.JLabel jLabelTerritorio34_2;
    private javax.swing.JLabel jLabelTerritorio35;
    private javax.swing.JLabel jLabelTerritorio36;
    private javax.swing.JLabel jLabelTerritorio37;
    private javax.swing.JLabel jLabelTerritorio38;
    private javax.swing.JLabel jLabelTerritorio39_1;
    private javax.swing.JLabel jLabelTerritorio39_2;
    private javax.swing.JLabel jLabelTerritorio3_1;
    private javax.swing.JLabel jLabelTerritorio3_2;
    private javax.swing.JLabel jLabelTerritorio4;
    private javax.swing.JLabel jLabelTerritorio40;
    private javax.swing.JLabel jLabelTerritorio41;
    private javax.swing.JLabel jLabelTerritorio42_1;
    private javax.swing.JLabel jLabelTerritorio42_2;
    private javax.swing.JLabel jLabelTerritorio43_1;
    private javax.swing.JLabel jLabelTerritorio43_2;
    private javax.swing.JLabel jLabelTerritorio44_1;
    private javax.swing.JLabel jLabelTerritorio44_2;
    private javax.swing.JLabel jLabelTerritorio45;
    private javax.swing.JLabel jLabelTerritorio46;
    private javax.swing.JLabel jLabelTerritorio47_1;
    private javax.swing.JLabel jLabelTerritorio47_2;
    private javax.swing.JLabel jLabelTerritorio48_1;
    private javax.swing.JLabel jLabelTerritorio48_2;
    private javax.swing.JLabel jLabelTerritorio49;
    private javax.swing.JLabel jLabelTerritorio50_1;
    private javax.swing.JLabel jLabelTerritorio50_2;
    private javax.swing.JLabel jLabelTerritorio51;
    private javax.swing.JLabel jLabelTerritorio5_1;
    private javax.swing.JLabel jLabelTerritorio5_2;
    private javax.swing.JLabel jLabelTerritorio6_1;
    private javax.swing.JLabel jLabelTerritorio6_2;
    private javax.swing.JLabel jLabelTerritorio7;
    private javax.swing.JLabel jLabelTerritorio8;
    private javax.swing.JLabel jLabelTerritorio9;
    private javax.swing.JLabel jLabelTextoDestino;
    private javax.swing.JLabel jLabelTextoInfo2;
    private javax.swing.JLabel jLabelTextoInformacion;
    private javax.swing.JLabel jLabelTextoJugadorEnTurno;
    private javax.swing.JLabel jLabelTextoOrigen;
    private javax.swing.JLabel jLabelTextoTropasDestino;
    private javax.swing.JLabel jLabelTextoTropasOrigen;
    private javax.swing.JLabel jLabelTiradaAtacante;
    private javax.swing.JLabel jLabelTiradaDefensor;
    private javax.swing.JLabel jLabelTropasDestino;
    private javax.swing.JLabel jLabelTropasImplicadas;
    private javax.swing.JLabel jLabelTropasOrigen;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JTextField jTextIntroduceInfo;
    // End of variables declaration//GEN-END:variables

    public void update(Observable o, Object arg) {
        jLabelTextoJugadorEnTurno.setText(j.getjugadores(j.gettur()).getNombre()+", lider de los "+ j.getjugadores(j.gettur()).getColor());
        barrido();
        jLabelTextoInformacion.removeAll();
        if(idTerritorioOrigen!=-1){
            jLabelTextoOrigen.setText(j.getTerrtiorio(idTerritorioOrigen).getNomTerritorio());
            jLabelTextoTropasOrigen.setText(Integer.toString(j.getTerrtiorio(idTerritorioOrigen).getNumTropas()));
        //jLabelTextoInformacion.setText(Integer.toString(t.getGanador()));
        }
        if(idTerritorioDestino!=-1){
            jLabelTextoDestino.setText(j.getTerrtiorio(idTerritorioDestino).getNomTerritorio());
            jLabelTextoTropasDestino.setText(Integer.toString(j.getTerrtiorio(idTerritorioDestino).getNumTropas()));
        //jLabelTextoInformacion.setText(Integer.toString(t.getGanador()));
        }
    }

    private void lanzarInvasion() {
        NOmuestraDados();
        String s=jTextIntroduceInfo.getText();
        if(s.isEmpty()){
            jLabelTextoInformacion.setText("Pero introduce algo chquillo!!");
        }
        else{
            int nTropasInvasion=Integer.parseInt(s);
            if (nTropasInvasion<j.getTerrtiorio(idTerritorioOrigen).getNumTropas()){
                Jugador jInvadido=j.poseedorterritorio(j.getTerrtiorio(idTerritorioDestino));
                j.invadir(idTerritorioOrigen, idTerritorioDestino, nTropasInvasion);
                invasion.play();
                dame_carta=1;
                jButtonAtacar.setVisible(true);
                jButtonCanjearCartas.setVisible(false);
                jButtonTransferirTropas.setVisible(false);
                jButtonVerEstado.setVisible(true);
                jButtonAnularSeleccion.setVisible(true);
                jButtonFinalizarTurno.setVisible(false);
                jButtonFinalizarFaseAtaque.setVisible(true);
                jButtonSalir.setVisible(true);
                jButtonGuardarPartida.setVisible(true);
                jButtonInvadir.setVisible(false);
                int idZona=j.getZonaDelTerritorio(j.getTerrtiorio(idTerritorioDestino).getIdentificador());
                //cuando el jugador que posee el turno y que ha 
                //invadido un territorio dentro de la zona 'idZona', es decir
                //dentro de la zona en la que ha invadido un territorio, 
                //devOLVERA true en caso de tener una zona completa
               //System.out.println("IDZONA -> COGIDO Y LANZADO");
                //jLabelTextoInfo2.setText("info2¡¡¡ENHORABUENA!!! Has conquistado la zona "+j.getNombreZonaDelTerritorio(j.getTerrtiorio(idTerritorioDestino).getIdentificador())+". ");
                if(j.getjugadores(j.gettur()).getNumTerritorios()==52){
                    jGanador=new jFrameGanador(j);
                    pantallaPrincipal.close();
                    aplausos.play();
                    victoria.play();
                    jGanador.setVisible(true);
                    activartablero=false;
                    jButtonAtacar.setVisible(false);
                    jButtonCanjearCartas.setVisible(false);
                    jButtonTransferirTropas.setVisible(false);
                    jButtonVerEstado.setVisible(true);
                    jButtonAnularSeleccion.setVisible(false);
                    jButtonFinalizarTurno.setVisible(false);
                    jButtonFinalizarFaseAtaque.setVisible(false);
                    jButtonSalir.setVisible(true);
                    jButtonGuardarPartida.setVisible(true);
                    jButtonInvadir.setVisible(false);
                }
                 if(jInvadido.getNumTerritorios()<1){
                    jLabelTextoInformacion.setText(jInvadido.getNombre()+" ha perdido todos sus territorios");
                    abandono.play();
                    jInvadido.setEsActivo(false);
                }
               
                if(j.tieneZonaCompleta(j.gettur(), idZona))
                   jLabelTextoInformacion.setText("¡¡¡¡ENHORABUENA!!!! Has conquistado la zona "+j.getNombreZonaDelTerritorio(j.getTerrtiorio(idTerritorioDestino).getIdentificador())+". ");
                   
                
            }
            else{
                jLabelTextoInformacion.setText("No dejes el territorio "+j.getTerrtiorio(idTerritorioOrigen).getNomTerritorio()+" vacio!!");
            }
        }
        barridoPoseedores();
        anularSeleccion();
    }

    private void pasarTurno() {
        NOmuestraDados();
        //barridoBotones();
        anularSeleccion();
        jLabelTextoInformacion.setText("");
        jLabelTextoInfo2.setText("");
        if(dame_carta==1){ //referente a cuando se invade
            j.obtenercarta();
            dame_carta=0;
        }
        j.getturno();
        
        while(!j.getjugadores(j.gettur()).getEsActivo()){
            j.getturno();
            System.out.print("Estoy pasando el puto turno");
        }
        if(j.getjugadores(j.gettur()).getNumCartas()>4){
            jLabelTextoInformacion.setText("Debes canjear tus cartas antes de seguir.");
            jButtonCanjearCartas.setVisible(true);
        }
        
        if (j.getjugadores(j.gettur()).getTropasPendUbicar()>0){
            jLabelTextoInformacion.setText("Debes ubicar tus tropas de refuerzo antes de cualquier otra acción");
            jButtonAtacar.setVisible(false);
            jButtonCanjearCartas.setVisible(true);
            jButtonTransferirTropas.setVisible(false);
            jButtonVerEstado.setVisible(true);
            jButtonFinalizarTurno.setVisible(false);
            jButtonSalir.setVisible(true);
            faseRefuerzo=true;
            
            
        }
    }


    private void transferir() {
        NOmuestraDados();
        String s=jTextIntroduceInfo.getText();
        if(s.isEmpty()){
            jLabelTextoInformacion.setText("Debes introducir un número de tropas en la linea de entrada");
        }
        else{
            int nTropasTransferencia=Integer.parseInt(s);
            if(j.getTerrtiorio(idTerritorioOrigen).getNumTropas()<=nTropasTransferencia){
                jLabelTextoInformacion.setText("No puedes dejar "+ j.getTerrtiorio(idTerritorioOrigen).getNomTerritorio()+" vacío");
            }
            else{
                if(!j.getjugadores(j.gettur()).ExisteTerritorio(j.getTerrtiorio(idTerritorioDestino))){
                    jLabelTextoInformacion.setText("El territorio "+ j.getTerrtiorio(idTerritorioDestino).getNomTerritorio()+ " no es tuyo!");
                }
                else{
                    j.transferir(idTerritorioOrigen, idTerritorioDestino, nTropasTransferencia);                }
            }
        }
    }

    private void ubicarTropas() {
        NOmuestraDados();
        barrido();
        if(idTerritorioOrigen==-1){
            jLabelTextoInformacion.setText("Debes elegir un territorio donde ubicar tus tropas de refuerzo");
        }
        else{
            j.ubicar(idTerritorioOrigen);
            idTerritorioOrigen=-1;
            jLabelTextoInformacion.setText("Te quedan "+ j.getjugadores(j.gettur()).getTropasPendUbicar()+" tropas por ubicar");
        }
        if (j.getjugadores(j.gettur()).getTropasPendUbicar()==0){
            faseRefuerzo=false;
            faseAtaque=true;
            barridoBotones();
        }
    }
    
     public void canjear(){
        if(j.getjugadores(j.gettur()).getNumCartas()>=2 && j.getjugadores(j.gettur()).getNumCartas()<=5)
        {
            if(j.comprobar_canjear_cartas()){
                jLabelTextoInformacion.setText("Las cartas han sido canjeadas!!!!!!");
                //j.getjugadores(j.gettur()).setcanj_tropas(1);
                int nTropasPend=j.getjugadores(j.gettur()).getTropasPendUbicar();
                j.canjear_cartas(nTropasPend);
            }
            else
                jLabelTextoInformacion.setText("Las cartas no pueden ser canjeadas!!!!!!");
        }
        else
            jLabelTextoInformacion.setText("Necesitas conseguir mas cartas!!"+j.getjugadores(j.gettur()).getNumCartas());
        
    
    }


}
