/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package windows;

/**
 *
 * @author Camila
 */
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JProgressBar;

/**
 * Clase en donde se almacenan todos los elementos graficos del sistema.*/
public class GameGUI extends javax.swing.JFrame {

    /**
     * Creates new form GameGUI
     */
    public GameGUI() {
        game = new MyGame();
        readFile();
        game.addWords();
        initComponents();
        jButtonsCategories = new ArrayList<javax.swing.JButton>();
        jProgressBarCategories = new ArrayList<javax.swing.JProgressBar>();
        jButtonsCategories.add(category0);
        jButtonsCategories.add(category1);
        jButtonsCategories.add(category2);
        jButtonsCategories.add(category3);
        jButtonsCategories.add(category4);
        jButtonsCategories.add(category5);
        jButtonsCategories.add(category6);        
        jProgressBarCategories.add(jProgressBarC0);
        jProgressBarCategories.add(jProgressBarC1);
        jProgressBarCategories.add(jProgressBarC2);
        jProgressBarCategories.add(jProgressBarC3);
        jProgressBarCategories.add(jProgressBarC4);
        jProgressBarCategories.add(jProgressBarC5);
        jProgressBarCategories.add(jProgressBarC6);
        
        c_in = 0;
        this.setLocationRelativeTo(null);
    }

    /**
     * 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")

    /**
     * Metodo que lee el archivo 'csv' y almacena todas las palabras en el sistema de juego
    */
    private void readFile(){
	    English eng;
        Spanish spa;
        Japanese jap;
        Finnish fin;
        Category c;
        Word w;	
        String cvsFile = "words_1.csv";
        BufferedReader br = null;
        String line = "";
        String cvsSplitBy = ";";		// Use comma as separator

        try {
                br = new BufferedReader(new FileReader(cvsFile));
                line = br.readLine();
                while ((line = br.readLine()) != null){
                        String[] word = line.split(cvsSplitBy);
                        if (!game.categoryExist(word[0])){
                                c = new Category(word[0]);
                                game.addCategory(c);
                        }
                        eng = new English(word[1]);
                        spa = new Spanish(word[2]);
                        jap = new Japanese(word[3]);
                        fin = new Finnish(word[4]);
                        w = new Word(word[0], eng, spa, jap, fin);

                        game.addWord(w);
                }
        } catch (FileNotFoundException e) {
                e.printStackTrace();
        } catch (IOException e) {
                e.printStackTrace();
        } finally {
                if (br != null) {
                        try {
                                br.close();
                        } catch (IOException e) {
                                e.printStackTrace();
                        }
                }
        }
        
    }
    /**
     * Cambia todos los textos del juego al idioma indicado en el string 's'
     * @param s     Idioma nativo
    */
    private void changeAllText(String s){
        if (s.equalsIgnoreCase("English")){
            jButton1.setText("Exit");
            jButton13.setText("Go back to menu");
            // jPanel2 <- After choosing Learning Language in jPanel1
            jButton7.setText("Start Game");
            jButton8.setText("Change Language");
            jButton9.setText("Change Learning L.");
            // jPanel3 <- Change Learning Language in jPanel2
            jButton10.setText("Spanish");
            jButton11.setText("Japanese");
            jButton12.setText("Finnish");
            // categoriesView <- Start Game in jPanel2
            jLabelCategory.setText("CATEGORIES");
            // playing <- After start playing a category
            jButtonNext.setText("NEXT");
            // jPanelEndCategory <- After finishing a category
            jLabelEndCatTitle.setText("End of category");
            jLabel3.setText("You've unlocked a new category");
            jButton14.setText("Continue");
        }
        else if (s.equalsIgnoreCase("Spanish")){
            jButton1.setText("Salir");
            jButton13.setText("Volver a menu");
            // jPanel2 <- After choosing Learning Language in jPanel1
            jButton7.setText("Empezar juego");
            jButton8.setText("Cambiar idioma");
            jButton9.setText("Aprender otro idioma");
            // jPanel3 <- Change Learning Language in jPanel2
            jButton10.setText("Ingles");
            jButton11.setText("Japones");
            jButton12.setText("Finlandes");
            // categoriesView <- Start Game in jPanel2
            jLabelCategory.setText("CATEGORIAS");
            // playing <- After start playing a category
            jButtonNext.setText("SIGUIENTE");
            // jPanelEndCategory <- After finishing a category
            jLabelEndCatTitle.setText("Fin de la categoria");
            jLabel3.setText("Has desbloqueado una nueva categoria");
            jButton14.setText("Continuar");        
        }
    }
    /**
     * Limpia el avance hecho en las categorias
     * Se usa en caso de que se cambie el idioma nativo o el que se desea aprender
    */
    private void clearCategoriesAdvance(){
        c_in = 0;
        for (JProgressBar pB: jProgressBarCategories){
            pB.setValue(0);
            pB.setVisible(false);
        }
        for (JButton b:jButtonsCategories)
            b.setVisible(false);
        jButtonsCategories.get(0).setVisible(true);
        jProgressBarCategories.get(0).setVisible(true);
    }
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    /**
     * Inicializa las componentes graficas utilizadas
    */
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList<>();
        jPanel4 = new javax.swing.JPanel();
        jSlider1 = new javax.swing.JSlider();
        jButton1 = new javax.swing.JButton();
        jButton13 = new javax.swing.JButton();
        jButton13.setVisible(false);
        jPanel1 = new javax.swing.JPanel();
        jButton6 = new javax.swing.JButton();
        jButton6.setVisible(false);
        jButton5 = new javax.swing.JButton();
        jButton5.setVisible(false);
        jButton4 = new javax.swing.JButton();
        jButton4.setVisible(false);
        jButton3 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel2.setVisible(false);
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jButton7 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jButton9 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jButton10 = new javax.swing.JButton();
        jButton11 = new javax.swing.JButton();
        jButton12 = new javax.swing.JButton();
        categoriesView = new javax.swing.JPanel();
        category0 = new javax.swing.JButton();
        category1 = new javax.swing.JButton();
        category1.setVisible(false);
        category2 = new javax.swing.JButton();
        category2.setVisible(false);
        category3 = new javax.swing.JButton();
        category3.setVisible(false);
        category4 = new javax.swing.JButton();
        category4.setVisible(false);
        category5 = new javax.swing.JButton();
        category5.setVisible(false);
        category6 = new javax.swing.JButton();
        category6.setVisible(false);
        jLabelCategory = new javax.swing.JLabel();
        jProgressBarC0 = new javax.swing.JProgressBar();
        jProgressBarC0.setMaximum(100);
        jProgressBarC1 = new javax.swing.JProgressBar();
        jProgressBarC1.setMaximum(100);
        jProgressBarC1.setVisible(false);
        jProgressBarC2 = new javax.swing.JProgressBar();
        jProgressBarC2.setMaximum(100);
        jProgressBarC2.setVisible(false);
        jProgressBarC3 = new javax.swing.JProgressBar();
        jProgressBarC3.setMaximum(100);
        jProgressBarC3.setVisible(false);
        jProgressBarC4 = new javax.swing.JProgressBar();
        jProgressBarC4.setMaximum(100);
        jProgressBarC4.setVisible(false);
        jProgressBarC5 = new javax.swing.JProgressBar();
        jProgressBarC5.setMaximum(100);
        jProgressBarC5.setVisible(false);
        jProgressBarC6 = new javax.swing.JProgressBar();
        jProgressBarC6.setMaximum(100);
        jProgressBarC6.setVisible(false);
        playing = new javax.swing.JPanel();
        jButtonAnswer0 = new javax.swing.JButton();
        jButtonAnswer1 = new javax.swing.JButton();
        jButtonAnswer2 = new javax.swing.JButton();
        jButtonAnswer3 = new javax.swing.JButton();
        jButtonNext = new javax.swing.JButton();
        jButtonNext.setVisible(false);
        jLabelOK = new javax.swing.JLabel();
        jLabelOK.setVisible(false);
        jLabelSourceWord = new javax.swing.JLabel();
        jPanelEndCategory = new javax.swing.JPanel();
        jLabelEndCatTitle = new javax.swing.JLabel();
        jLabelEndCatNameTitle = new javax.swing.JLabel();
        jLabelScore = new javax.swing.JLabel();
        jButton14 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jLabelBackground = new javax.swing.JLabel();

        jList1.setModel(new javax.swing.AbstractListModel<String>() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public String getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(jList1);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setUndecorated(true);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jButton1.setBackground(new java.awt.Color(8, 61, 8));
        jButton1.setFont(new java.awt.Font("Century Gothic", 1, 14)); // NOI18N
        jButton1.setForeground(new java.awt.Color(255, 255, 255));
        jButton1.setText("Exit");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(415, 530, 70, -1));

        jButton13.setBackground(new java.awt.Color(8, 61, 8));
        jButton13.setFont(new java.awt.Font("Century Gothic", 1, 14)); // NOI18N
        jButton13.setForeground(new java.awt.Color(255, 255, 255));
        jButton13.setText("Go back to menu");
        jButton13.setPreferredSize(new java.awt.Dimension(160, 27));
        jButton13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton13ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton13, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 530, -1, -1));

        jPanel1.setOpaque(false);

        jButton6.setFont(new java.awt.Font("Century Gothic", 0, 14)); // NOI18N
        jButton6.setText("Finnish");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jButton5.setFont(new java.awt.Font("Century Gothic", 0, 14)); // NOI18N
        jButton5.setText("Japanese");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton4.setFont(new java.awt.Font("Century Gothic", 0, 14)); // NOI18N
        jButton4.setText("Spanish");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton3.setFont(new java.awt.Font("Century Gothic", 0, 14)); // NOI18N
        jButton3.setText("Spanish");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton2.setFont(new java.awt.Font("Century Gothic", 0, 14)); // NOI18N
        jButton2.setText("English");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Century Gothic", 0, 26)); // NOI18N
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Choose language you want to learn:");

        jLabel1.setFont(new java.awt.Font("Century Gothic", 0, 30)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Choose your language:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(56, 56, 56)
                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(96, 96, 96))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                        .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(54, 54, 54)
                                        .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                        .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(92, 92, 92)))
                                .addGap(87, 87, 87)))
                        .addContainerGap())))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addGap(87, 87, 87)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(67, 67, 67)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(34, 34, 34)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(82, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 500, 570));

        jPanel2.setOpaque(false);
        jPanel2.setPreferredSize(new java.awt.Dimension(500, 570));
        jPanel2.setVisible(false);

        jButton7.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        jButton7.setText("Start Game");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jButton8.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        jButton8.setText("Change Language");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        jButton9.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        jButton9.setText("Change Learning L.");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(114, 114, 114)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jButton9, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
                    .addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(116, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap(101, Short.MAX_VALUE)
                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44)
                .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44)
                .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(111, 111, 111))
        );

        getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 500, -1));

        jPanel3.setOpaque(false);
        jPanel3.setVisible(false);

        jButton10.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        jButton10.setText("Spanish");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        jButton11.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        jButton11.setText("Japanese");
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        jButton12.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        jButton12.setText("Finnish");
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addContainerGap(118, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(112, 112, 112))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(91, 91, 91)
                .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44)
                .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(43, 43, 43)
                .addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(122, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        categoriesView.setOpaque(false);
        categoriesView.setVisible(false);

        category0.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        category0.setText("Category 0");
        category0.setPreferredSize(new java.awt.Dimension(165, 40));
        category0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                category0ActionPerformed(evt);
            }
        });

        category1.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        category1.setText("Category 1");
        category1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                category1ActionPerformed(evt);
            }
        });

        category2.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        category2.setText("Category 2");
        category2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                category2ActionPerformed(evt);
            }
        });

        category3.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        category3.setText("Category 3");
        category3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                category3ActionPerformed(evt);
            }
        });

        category4.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        category4.setText("Category 4");
        category4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                category4ActionPerformed(evt);
            }
        });

        category5.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        category5.setText("Category 5");
        category5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                category5ActionPerformed(evt);
            }
        });

        category6.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        category6.setText("Category 6");
        category6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                category6ActionPerformed(evt);
            }
        });

        jLabelCategory.setFont(new java.awt.Font("Century Gothic", 0, 48)); // NOI18N
        jLabelCategory.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelCategory.setText("CATEGORIES");

        javax.swing.GroupLayout categoriesViewLayout = new javax.swing.GroupLayout(categoriesView);
        categoriesView.setLayout(categoriesViewLayout);
        categoriesViewLayout.setHorizontalGroup(
            categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabelCategory, javax.swing.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
            .addGroup(categoriesViewLayout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jProgressBarC6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jProgressBarC0, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(category0, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
                    .addComponent(jProgressBarC2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(category2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(category4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(category6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jProgressBarC4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(categoriesViewLayout.createSequentialGroup()
                        .addComponent(jProgressBarC1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(categoriesViewLayout.createSequentialGroup()
                        .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(category1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
                                .addComponent(jProgressBarC3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(category3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
                                .addComponent(category5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addComponent(jProgressBarC5, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
        categoriesViewLayout.setVerticalGroup(
            categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(categoriesViewLayout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(categoriesViewLayout.createSequentialGroup()
                        .addComponent(jLabelCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(46, 46, 46)
                        .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(category0, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(category1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jProgressBarC0, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jProgressBarC1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(category2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(category3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jProgressBarC2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jProgressBarC3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(categoriesViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(category5, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(category4, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jProgressBarC4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jProgressBarC5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(category6, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jProgressBarC6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(100, Short.MAX_VALUE))
        );

        getContentPane().add(categoriesView, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        playing.setOpaque(false);
        playing.setPreferredSize(new java.awt.Dimension(500, 570));
        playing.setVisible(false);

        jButtonAnswer0.setFont(new java.awt.Font("Century Gothic", 0, 18)); // NOI18N
        jButtonAnswer0.setText("Answer 0");
        jButtonAnswer0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAnswer0ActionPerformed(evt);
            }
        });

        jButtonAnswer1.setFont(new java.awt.Font("Century Gothic", 0, 18)); // NOI18N
        jButtonAnswer1.setText("Answer 1");
        jButtonAnswer1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAnswer1ActionPerformed(evt);
            }
        });

        jButtonAnswer2.setFont(new java.awt.Font("Century Gothic", 0, 18)); // NOI18N
        jButtonAnswer2.setText("Answer 2");
        jButtonAnswer2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAnswer2ActionPerformed(evt);
            }
        });

        jButtonAnswer3.setFont(new java.awt.Font("Century Gothic", 0, 18)); // NOI18N
        jButtonAnswer3.setText("Answer 3");
        jButtonAnswer3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAnswer3ActionPerformed(evt);
            }
        });

        jButtonNext.setFont(new java.awt.Font("Century Gothic", 0, 24)); // NOI18N
        jButtonNext.setText("NEXT");
        jButtonNext.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNextActionPerformed(evt);
            }
        });

        jLabelOK.setFont(new java.awt.Font("Century Gothic", 0, 72)); // NOI18N
        jLabelOK.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelOK.setText(":)");

        jLabelSourceWord.setFont(new java.awt.Font("Century Gothic", 0, 48)); // NOI18N
        jLabelSourceWord.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelSourceWord.setText("Source Word");

        javax.swing.GroupLayout playingLayout = new javax.swing.GroupLayout(playing);
        playing.setLayout(playingLayout);
        playingLayout.setHorizontalGroup(
            playingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, playingLayout.createSequentialGroup()
                .addGap(0, 111, Short.MAX_VALUE)
                .addComponent(jLabelSourceWord, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(89, 89, 89))
            .addGroup(playingLayout.createSequentialGroup()
                .addGroup(playingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(playingLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addGroup(playingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jButtonAnswer2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButtonAnswer0, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE))
                        .addGap(40, 40, 40)
                        .addGroup(playingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jButtonAnswer1, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
                            .addComponent(jButtonAnswer3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(playingLayout.createSequentialGroup()
                        .addGap(171, 171, 171)
                        .addComponent(jLabelOK, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(playingLayout.createSequentialGroup()
                        .addGap(197, 197, 197)
                        .addComponent(jButtonNext)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        playingLayout.setVerticalGroup(
            playingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(playingLayout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addComponent(jLabelSourceWord, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(38, 38, 38)
                .addGroup(playingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonAnswer0, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonAnswer1, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addGroup(playingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonAnswer2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonAnswer3, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(43, 43, 43)
                .addComponent(jLabelOK, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButtonNext, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44))
        );

        getContentPane().add(playing, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        jPanelEndCategory.setOpaque(false);
        jPanelEndCategory.setVisible(false);

        jLabelEndCatTitle.setFont(new java.awt.Font("Century Gothic", 0, 36)); // NOI18N
        jLabelEndCatTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelEndCatTitle.setText("End of category");

        jLabelEndCatNameTitle.setFont(new java.awt.Font("Century Gothic", 0, 48)); // NOI18N
        jLabelEndCatNameTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelEndCatNameTitle.setText("Categories's Name");

        jLabelScore.setFont(new java.awt.Font("Century Gothic", 0, 52)); // NOI18N
        jLabelScore.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelScore.setText("Score");

        jButton14.setFont(new java.awt.Font("Century Gothic", 0, 18)); // NOI18N
        jButton14.setText("Continue");
        jButton14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton14ActionPerformed(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Century Gothic", 0, 18)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("You've unlocked a new category");

        javax.swing.GroupLayout jPanelEndCategoryLayout = new javax.swing.GroupLayout(jPanelEndCategory);
        jPanelEndCategory.setLayout(jPanelEndCategoryLayout);
        jPanelEndCategoryLayout.setHorizontalGroup(
            jPanelEndCategoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelEndCategoryLayout.createSequentialGroup()
                .addGap(164, 164, 164)
                .addComponent(jLabelScore, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelEndCategoryLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(183, 183, 183))
            .addGroup(jPanelEndCategoryLayout.createSequentialGroup()
                .addContainerGap(30, Short.MAX_VALUE)
                .addGroup(jPanelEndCategoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanelEndCategoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jLabelEndCatTitle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabelEndCatNameTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(30, Short.MAX_VALUE))
        );
        jPanelEndCategoryLayout.setVerticalGroup(
            jPanelEndCategoryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelEndCategoryLayout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addComponent(jLabelEndCatTitle)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabelEndCatNameTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(41, 41, 41)
                .addComponent(jLabelScore, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47)
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(72, Short.MAX_VALUE))
        );

        getContentPane().add(jPanelEndCategory, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

        jLabelBackground.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/green-background-opaque.jpg"))); // NOI18N
        jLabelBackground.setInheritsPopupMenu(false);
        getContentPane().add(jLabelBackground, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 500, 570));

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    /**
    * Cierra el programa
    * @param evt  Se presiono el boton 1
    */
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
    * Muestra las opciones para seleccionar el idioma a aprender en español
    * Y setea el idioma nativo del juego
    * @param evt  Se presiono el boton 3
    */
    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
        jLabel2.setText("Elije el idioma que desees aprender:");
        jButton4.setText("Ingles");
        jButton5.setText("Japones");
        jButton6.setText("Finlandes");
        changeAllText("Spanish");
        
        game.setSource(jButton3.getText());
        jLabel2.setVisible(true);
        jButton4.setVisible(true);
        jButton5.setVisible(true);
        jButton6.setVisible(true);
    }//GEN-LAST:event_jButton3ActionPerformed

    /**
    * Muestra las opciones para seleccionar el idioma a aprender en ingles
    * Y setea el idioma nativo del juego
    * @param evt  Se presiono el boton 2
    */
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
        jLabel2.setText("Choose language you want to learn:");
        jButton4.setText("Spanish");
        jButton5.setText("Japanese");
        jButton6.setText("Finnish");
        changeAllText("English");
        
        game.setSource(jButton2.getText());
        jLabel2.setVisible(true);
        jButton4.setVisible(true);
        jButton5.setVisible(true);
        jButton6.setVisible(true);
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
    * Se setea el idioma a aprender y habilita un nuevo menu
    * @param evt  Se presiono el boton 4
    */
    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        game.setLearning(jButton4.getText());
        jPanel1.setVisible(false);
        jPanel2.setVisible(true);
    }//GEN-LAST:event_jButton4ActionPerformed

    /**
    * Se setea el idioma a aprender y habilita un nuevo menu
    * @param evt  Se presiono el boton 4
    */
    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        // TODO add your handling code here:
        game.setLearning(jButton5.getText());
        jPanel1.setVisible(false);
        jPanel2.setVisible(true);
    }//GEN-LAST:event_jButton5ActionPerformed

    /**
    * Se setea el idioma a aprender y habilita un nuevo menu
    * @param evt  Se presiono el boton 4
    */
    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        // TODO add your handling code here:
        game.setLearning(jButton6.getText());
        jPanel1.setVisible(false);
        jPanel2.setVisible(true);
    }//GEN-LAST:event_jButton6ActionPerformed

    /**
    * Se cambia el idioma nativo
    * @param evt  Se presiono el boton 8
    */
    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        // TODO add your handling code here:
        if (game.getSource().equalsIgnoreCase("English"))
            changeAllText("Spanish");
        else if (game.getSource().equalsIgnoreCase("Spanish"))
            changeAllText("English");
        game.toggleSource();
        clearCategoriesAdvance();
    }//GEN-LAST:event_jButton8ActionPerformed

    /**
    * Se habilita un nuevo menu, en donde aparecen opciones nuevas de idioma a aprender
    * @param evt  Se presiono el boton 9
    */
    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        // TODO add your handling code here:
        jPanel2.setVisible(false);
        jPanel3.setVisible(true);
        jButton13.setVisible(true);
    }//GEN-LAST:event_jButton9ActionPerformed

    /**
    * Se habilita el menu de las categorias
    * @param evt  Se presiono el boton 7
    */
    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        // TODO add your handling code here:
        category0.setText(game.getCategory(0));
        category1.setText(game.getCategory(1));
        category2.setText(game.getCategory(2));
        category3.setText(game.getCategory(3));
        category4.setText(game.getCategory(4));
        category5.setText(game.getCategory(5));
        category6.setText(game.getCategory(6));
        jPanel2.setVisible(false);
        jButton13.setVisible(true);
        categoriesView.setVisible(true);
    }//GEN-LAST:event_jButton7ActionPerformed

    /**
    * Se setea el idioma a aprender y se habilita el menu principal
    * @param evt  Se presiono el boton 10
    */
    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        // TODO add your handling code here:
        game.setLearning(jButton10.getText());
        jPanel3.setVisible(false);
        jPanel2.setVisible(true);
        clearCategoriesAdvance();
    }//GEN-LAST:event_jButton10ActionPerformed

    /**
    * Se setea el idioma a aprender y se habilita el menu principal
    * @param evt  Se presiono el boton 11
    */
    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        // TODO add your handling code here:
        game.setLearning(jButton11.getText());
        jPanel3.setVisible(false);
        jPanel2.setVisible(true);
        clearCategoriesAdvance();
    }//GEN-LAST:event_jButton11ActionPerformed

    /**
    * Se setea el idioma a aprender y se habilita el menu principal
    * @param evt  Se presiono el boton 12
    */
    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
        // TODO add your handling code here:
        game.setLearning(jButton12.getText());
        jPanel3.setVisible(false);
        jPanel2.setVisible(true);
        clearCategoriesAdvance();
    }//GEN-LAST:event_jButton12ActionPerformed

    /**
    * Se empieza a jugar la categoria 0
    * @param evt  Se presiono el boton category0
    */
    private void category0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_category0ActionPerformed
        // TODO add your handling code here:
        game.playCategory(0, jLabelSourceWord, jButtonAnswer0, jButtonAnswer1, 
                            jButtonAnswer2, jButtonAnswer3);
        current_category = game.getCategories().get(0);
        categoriesView.setVisible(false);
        playing.setVisible(true);
    }//GEN-LAST:event_category0ActionPerformed

    /**
    * Se empieza a jugar la categoria 1
    * @param evt  Se presiono el boton category1
    */
    private void category1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_category1ActionPerformed
        // TODO add your handling code here:
        game.playCategory(1, jLabelSourceWord, jButtonAnswer0, jButtonAnswer1, 
                            jButtonAnswer2, jButtonAnswer3);
        current_category = game.getCategories().get(1);
        categoriesView.setVisible(false);
        playing.setVisible(true);
    }//GEN-LAST:event_category1ActionPerformed

    /**
    * Se empieza a jugar la categoria 2
    * @param evt  Se presiono el boton category2
    */
    private void category2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_category2ActionPerformed
        // TODO add your handling code here:
        game.playCategory(2, jLabelSourceWord, jButtonAnswer0, jButtonAnswer1,
                            jButtonAnswer2, jButtonAnswer3);
        current_category = game.getCategories().get(2);
        categoriesView.setVisible(false);
        playing.setVisible(true);
    }//GEN-LAST:event_category2ActionPerformed

    /**
    * Se empieza a jugar la categoria 3
    * @param evt  Se presiono el boton category3
    */
    private void category3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_category3ActionPerformed
        // TODO add your handling code here:
        game.playCategory(3, jLabelSourceWord, jButtonAnswer0, jButtonAnswer1,
                            jButtonAnswer2, jButtonAnswer3);
        current_category = game.getCategories().get(3);
        categoriesView.setVisible(false);
        playing.setVisible(true);
    }//GEN-LAST:event_category3ActionPerformed

    /**
    * Se empieza a jugar la categoria 4
    * @param evt  Se presiono el boton category4
    */
    private void category4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_category4ActionPerformed
        // TODO add your handling code here:
        game.playCategory(4, jLabelSourceWord, jButtonAnswer0, jButtonAnswer1,
                            jButtonAnswer2, jButtonAnswer3);
        current_category = game.getCategories().get(4);
        categoriesView.setVisible(false);
        playing.setVisible(true);
    }//GEN-LAST:event_category4ActionPerformed

    /**
    * Se empieza a jugar la categoria 5
    * @param evt  Se presiono el boton category5
    */
    private void category5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_category5ActionPerformed
        // TODO add your handling code here:
        game.playCategory(5, jLabelSourceWord, jButtonAnswer0, jButtonAnswer1,
                            jButtonAnswer2, jButtonAnswer3);
        current_category = game.getCategories().get(5);
        categoriesView.setVisible(false);
        playing.setVisible(true);
    }//GEN-LAST:event_category5ActionPerformed

    /**
    * Se empieza a jugar la categoria 6
    * @param evt  Se presiono el boton category6
    */
    private void category6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_category6ActionPerformed
        // TODO add your handling code here:
        game.playCategory(6, jLabelSourceWord, jButtonAnswer0, jButtonAnswer1,
                            jButtonAnswer2, jButtonAnswer3);
        current_category = game.getCategories().get(6);
        categoriesView.setVisible(false);
        playing.setVisible(true);
    }//GEN-LAST:event_category6ActionPerformed

    /**
    * Revisa si la opcion seleccionada es correcta o incorrecta, en caso de ser correcta aumenta el score
    * Habilita el boton para continuar con las preguntar
    * @param evt  Se presiono el boton jButtonAnswer0
    */
    private void jButtonAnswer0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAnswer0ActionPerformed
        // TODO add your handling code here:
        String answer = jButtonAnswer0.getText();
        if (answer.equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex()))){
            game.upScore();
            jButtonAnswer0.setBackground(new java.awt.Color(102,255,102));
            jLabelOK.setText(":)");
        }
        else {
            if (jButtonAnswer1.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
                jButtonAnswer1.setBackground(new java.awt.Color(102,255,102));
            else if (jButtonAnswer2.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
                jButtonAnswer2.setBackground(new java.awt.Color(102,255,102));
            //else if (jButtonAnswer3.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
            else
                jButtonAnswer3.setBackground(new java.awt.Color(102,255,102));
            jButtonAnswer0.setBackground(new java.awt.Color(255,51,51));
            jLabelOK.setText(":(");
        }
        jLabelOK.setVisible(true);
        jButtonNext.setVisible(true);
    }//GEN-LAST:event_jButtonAnswer0ActionPerformed

    /**
    * Revisa si la opcion seleccionada es correcta o incorrecta, en caso de ser correcta aumenta el score
    * Habilita el boton para continuar con las preguntar
    * @param evt  Se presiono el boton jButtonAnswer1
    */
    private void jButtonAnswer1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAnswer1ActionPerformed
        // TODO add your handling code here:
        String answer = jButtonAnswer1.getText();
        if (answer.equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex()))){
            game.upScore();
            jButtonAnswer1.setBackground(new java.awt.Color(102,255,102));
            jLabelOK.setText(":)");
        }
        else {
            if (jButtonAnswer0.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
                jButtonAnswer0.setBackground(new java.awt.Color(102,255,102));
            else if (jButtonAnswer2.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
                jButtonAnswer2.setBackground(new java.awt.Color(102,255,102));
            //else if (jButtonAnswer3.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
            else
                jButtonAnswer3.setBackground(new java.awt.Color(102,255,102));
            jButtonAnswer1.setBackground(new java.awt.Color(255,51,51));
            jLabelOK.setText(":(");
        }
        jLabelOK.setVisible(true);
        jButtonNext.setVisible(true);
    }//GEN-LAST:event_jButtonAnswer1ActionPerformed

    /**
    * Revisa si la opcion seleccionada es correcta o incorrecta, en caso de ser correcta aumenta el score
    * Habilita el boton para continuar con las preguntar
    * @param evt  Se presiono el boton jButtonAnswer2
    */
    private void jButtonAnswer2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAnswer2ActionPerformed
        // TODO add your handling code here:
        String answer = jButtonAnswer2.getText();
        if (answer.equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex()))){
            game.upScore();
            jButtonAnswer2.setBackground(new java.awt.Color(102,255,102));
            jLabelOK.setText(":)");
        }
        else {
            if (jButtonAnswer1.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
                jButtonAnswer1.setBackground(new java.awt.Color(102,255,102));
            else if (jButtonAnswer0.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
                jButtonAnswer0.setBackground(new java.awt.Color(102,255,102));
            //else if (jButtonAnswer3.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
            else
                jButtonAnswer3.setBackground(new java.awt.Color(102,255,102));
            jButtonAnswer2.setBackground(new java.awt.Color(255,51,51));
            jLabelOK.setText(":(");
        }
        jLabelOK.setVisible(true);
        jButtonNext.setVisible(true);
    }//GEN-LAST:event_jButtonAnswer2ActionPerformed

    /**
    * Revisa si la opcion seleccionada es correcta o incorrecta, en caso de ser correcta aumenta el score
    * Habilita el boton para continuar con las preguntar
    * @param evt  Se presiono el boton jButtonAnswer3
    */
    private void jButtonAnswer3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAnswer3ActionPerformed
        // TODO add your handling code here:
        String answer = jButtonAnswer3.getText();
        if (answer.equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex()))){
            game.upScore();
            jButtonAnswer3.setBackground(new java.awt.Color(102,255,102));
            jLabelOK.setText(":)");
        }
        else {
            if (jButtonAnswer1.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex()))){
                jButtonAnswer1.setBackground(new java.awt.Color(102,255,102));
            }
            else if (jButtonAnswer2.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
                jButtonAnswer2.setBackground(new java.awt.Color(102,255,102));
            //else if (jButtonAnswer3.getText().equalsIgnoreCase(game.getCorrect().getLearningWord(game.getLearnIndex())))
            else
                jButtonAnswer0.setBackground(new java.awt.Color(102,255,102));
            jButtonAnswer3.setBackground(new java.awt.Color(255,51,51));
            jLabelOK.setText(":(");
        }
        jLabelOK.setVisible(true);
        jButtonNext.setVisible(true);
    }//GEN-LAST:event_jButtonAnswer3ActionPerformed

    /**
    * Revisa si quedan palabras en la categoria, si quedan va a continuar con las preguntas,
    * En caso de terminar la categoria, habilita el panel de 'fin de categoria' en donde se muestra el porcentaje correcto
    * Y se asigna este porcentaje a la barra de progreso de la categoria correspondiente
    * @param evt  Se presiono el boton jButtonNext
    */
    private void jButtonNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNextActionPerformed
        // TODO add your handling code here:
        jLabelOK.setVisible(false);
        jButtonNext.setVisible(false);
        jButtonAnswer0.setBackground(new java.awt.Color(240,240,240));
        jButtonAnswer1.setBackground(new java.awt.Color(240,240,240));
        jButtonAnswer2.setBackground(new java.awt.Color(240,240,240));
        jButtonAnswer3.setBackground(new java.awt.Color(240,240,240));
        
        if(!game.isEndOfCategory()){
            game.nextWord(jLabelSourceWord, jButtonAnswer0, jButtonAnswer1, jButtonAnswer2, jButtonAnswer3);//, jButtonNext);
        }
        else{
            playing.setVisible(false);
            jPanelEndCategory.setVisible(true);
            jLabelEndCatNameTitle.setText(game.getCurrentCatName());
            game.endCategory();
            jLabelScore.setText(game.getScore()+"%");
            int i = 0;
            for (Category c:game.getCategories()){
                if (c.getName().equalsIgnoreCase(current_category.getName())){
                    c_in = i;
                    break;
                }
                i++;
            }
            jProgressBarCategories.get(c_in).setValue(game.getScore());
            if(game.getScore() > 60){
                if (game.getSource().equalsIgnoreCase("English"))
                    jLabel3.setText("You've unlocked a new category");
                else if (game.getSource().equalsIgnoreCase("Spanish"))
                    jLabel3.setText("Has desbloqueado una nueva categoria");
                jButtonsCategories.get(++c_in).setVisible(true);
                jProgressBarCategories.get(c_in).setVisible(true);
            }
            else
                if (game.getSource().equalsIgnoreCase("English"))
                    jLabel3.setText("You still have a lot to learn!");
                else if (game.getSource().equalsIgnoreCase("Spanish"))
                    jLabel3.setText("Aún te falta por aprender!");
        }
        
    }//GEN-LAST:event_jButtonNextActionPerformed

    /**
    * Se habilita el menu de las categorias
    * @param evt  Se presiono el boton jButton14, que es una especie de 'Continuar'
    */
    private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
        // TODO add your handling code here:
        jPanelEndCategory.setVisible(false);
        categoriesView.setVisible(true);
    }//GEN-LAST:event_jButton14ActionPerformed

    /**
    * Se vuelve al menu principal, y se resetean todas las variables de una catgoria que estuviera en progreso
    * @param evt  Se presiono el boton jButton13, boton para volver al menu principal
    */
    private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
        // TODO add your handling code here:
        jPanel2.setVisible(true);
        jPanel3.setVisible(false);
        categoriesView.setVisible(false);
        playing.setVisible(false);
        jPanelEndCategory.setVisible(false);
        game.getPlaying().clear();
        game.resetScore();
    }//GEN-LAST:event_jButton13ActionPerformed

    /**
     * Metodo main
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(GameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(GameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(GameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(GameGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GameGUI().setVisible(true);
            }
        });
    }
    private MyGame game;
    private Category current_category;
    private ArrayList<javax.swing.JButton> jButtonsCategories;
    private ArrayList<javax.swing.JProgressBar> jProgressBarCategories;
    private int c_in;       // Last category unlocked
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel categoriesView;
    private javax.swing.JButton category0;
    private javax.swing.JButton category1;
    private javax.swing.JButton category2;
    private javax.swing.JButton category3;
    private javax.swing.JButton category4;
    private javax.swing.JButton category5;
    private javax.swing.JButton category6;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JButton jButtonAnswer0;
    private javax.swing.JButton jButtonAnswer1;
    private javax.swing.JButton jButtonAnswer2;
    private javax.swing.JButton jButtonAnswer3;
    private javax.swing.JButton jButtonNext;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabelBackground;
    private javax.swing.JLabel jLabelCategory;
    private javax.swing.JLabel jLabelEndCatNameTitle;
    private javax.swing.JLabel jLabelEndCatTitle;
    private javax.swing.JLabel jLabelOK;
    private javax.swing.JLabel jLabelScore;
    private javax.swing.JLabel jLabelSourceWord;
    private javax.swing.JList<String> jList1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanelEndCategory;
    private javax.swing.JProgressBar jProgressBarC0;
    private javax.swing.JProgressBar jProgressBarC1;
    private javax.swing.JProgressBar jProgressBarC2;
    private javax.swing.JProgressBar jProgressBarC3;
    private javax.swing.JProgressBar jProgressBarC4;
    private javax.swing.JProgressBar jProgressBarC5;
    private javax.swing.JProgressBar jProgressBarC6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSlider jSlider1;
    private javax.swing.JPanel playing;
    // End of variables declaration//GEN-END:variables
}
