package coolPlayerControl;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;

import knowledgeAndTechnics.BaseFunctions;



/**
 * @author Soccer Group 1
 *
 */
public class CoolPlayerControl extends JFrame {
	
	private JLabel kickLabel = new JLabel();  //  @jve:decl-index=0:visual-constraint="71,59"
	private JProgressBar jProgressBar = null;  //  @jve:decl-index=0:visual-constraint="251,28"
	private JPanel jPanel = null;
	private KeyControl keyControl = null;
	private BaseFunctions baseFunctions;
	
	/**
	 * This method initializes 
	 * 
	 */
	public CoolPlayerControl(BaseFunctions baseFunctions) {
		super();
		this.baseFunctions = baseFunctions; //selbst erstellt
		initialize();
		
	}
	/**
	 * This method initializes this
	 * 
	 */
	private void initialize() {
		//Meine Eintraege:
		keyControl = new KeyControl(this, baseFunctions);
		this.addKeyListener(keyControl);
		//generiert:
		this.setContentPane(getJPanel());
        kickLabel.setText("kick Power:");
        this.setResizable(false);
        this.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
        this.setTitle("Cool Player Control");
        this.setSize(248, 62);
			
	}
	
	public void setKickPower(int value){
		jProgressBar.setValue(value);
	}
	
	/**
	 * This method initializes jProgressBar	
	 * 	
	 * @return javax.swing.JProgressBar	
	 */    
	private JProgressBar getJProgressBar() {
		if (jProgressBar == null) {
			jProgressBar = new JProgressBar();
			jProgressBar.setForeground(java.awt.Color.red);
		}
		return jProgressBar;
	}
	/**
	 * This method initializes jPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */    
	private JPanel getJPanel() {
		if (jPanel == null) {
			jPanel = new JPanel();
			jPanel.add(kickLabel, null);
			jPanel.add(getJProgressBar(), null);
		}
		return jPanel;
	}
	
	public void tick(){
		keyControl.tick();
	}
	
  	/*public static void main(String[] args){
		CoolPlayerControl cpc = new CoolPlayerControl();
		cpc.setVisible(true);
		while (true){
			
			cpc.tick();
			try {
				Thread.sleep(100);
			}
			catch (Exception e){
				//do nothing
			}
		}
	}*/
}  //  @jve:decl-index=0:visual-constraint="197,83"
