/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hirka;

import java.awt.Font;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author dimitri
 */
public class Panel extends JPanel {

    private JLabel texte;
    private ArrayList<String> listeChars;
    private Random random;

    public Panel(ArrayList<String> listeChars) {
        this.random = new Random();
        this.listeChars = listeChars;
        this.texte = new JLabel();
        this.texte.setFont(new Font("Bitstream Cyberbit", Font.PLAIN, 80));
        this.setRandomChar();
        this.add(texte);
    }

    private void setRandomChar() {        
        int num = this.random.nextInt(this.listeChars.size());
        this.texte.setText(this.listeChars.get(num));
    }
    
    public void setChar() {
        this.setRandomChar();
    }
}
