package views;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import controllers.ButtonHelpManager;
import controllers.StatisticsPanelManager;
import models.CurrentPlayerList;
import models.Player;
public class StatisticsPanel extends JPanel{
private CurrentPlayerList currentPlayerList;
private ArrayList<JPanel> panelList;
private HelpPanel helpPanel;
public StatisticsPanel(CurrentPlayerList currentPlayerList, HelpPanel helpPanel){
super(new GridLayout(8,1));
this.setBorder(BorderFactory.createLineBorder(Color.black));
this.currentPlayerList = currentPlayerList;
this.helpPanel = helpPanel;
panelList = new ArrayList<JPanel>();
for (int i=0;i<8;i++){
panelList.add(new JPanel(new FlowLayout()));
this.add(panelList.get(i));
}
panelList.get(0).add(new JLabel("Bank"));
panelList.get(0).add(new JLabel("Victories : "+currentPlayerList.getBank().getVictories()));
panelList.get(0).add(new JLabel(""));
panelList.get(0).add(new JLabel(""));
panelList.get(0).setBorder(BorderFactory.createLineBorder(Color.black));
showPanel();
MouseListener listener = new StatisticsPanelManager(helpPanel);
this.addMouseListener(listener);
}
public void showPanel(){
for (int i=0;i<currentPlayerList.getPlayerList().size();i++){
Player player = currentPlayerList.getPlayerList().get(i);
panelList.get(i+1).add(new JLabel(""+player.getName()));
panelList.get(i+1).add(new JLabel("Victories : "+player.getVictories()));
panelList.get(i+1).add(new JLabel("Stack : "+player.getStack()));
panelList.get(i+1).add(new JLabel("Current Bet : "+player.getBetMount()));
panelList.get(i+1).setBorder(BorderFactory.createLineBorder(Color.black));
}
}
}