package Darts;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JPanel;

public class DartPlay4Scores extends JPanel implements MouseListener
	{
	//
	// Member Data
	//
	DartScorePane[] 	scorePanes = new DartScorePane[4];
	Darts  	         	mainObj;    // For witching to play mode
	//
	// Constructor
	//
	public DartPlay4Scores( Darts newMainObj )
		{
		super( new GridBagLayout() );
		
		mainObj = newMainObj;
		
		addMouseListener( this );
		
		scorePanes[0] = new DartScorePane( "Previous Victim", new Color(250, 240, 240), false );
		scorePanes[1] = new DartScorePane( "Previous Player", new Color(240, 250, 240), false );
		scorePanes[2] = new DartScorePane( "Victim", new Color(250, 240, 250), false );
		scorePanes[3] = new DartScorePane( "Player", new Color(243, 243, 243), true );

		GridBagConstraints  c = new GridBagConstraints();
		c.fill = GridBagConstraints.BOTH;
		//c.gridwidth = GridBagConstraints.REMAINDER; //end row
		c.weightx = 1;
		c.weighty = 1;
		
		c.gridx = 0;
		c.gridy = 0;
		add( scorePanes[0], c );
		
		c.gridx = 1;
		add( scorePanes[1], c );
		
		c.gridx = 0;
		c.gridy = 1;
		add( scorePanes[2], c );
		
		c.gridx = 1;
		add( scorePanes[3], c );
		}
	
	public void setPlayers( DisplayScore[] scores )
		{
		for( int i=0; i<4; i++ )
			{
			scorePanes[i].setScore( scores[i] );
			scorePanes[i].repaint();
			}
		}

	public void mouseClicked(MouseEvent arg0)
		{
		// TODO Auto-generated method stub
		mainObj.threePaneMode();
		}

	public void mousePressed(MouseEvent arg0)
		{
		// TODO Auto-generated method stub
		
		}

	public void mouseReleased(MouseEvent arg0)
		{
		// TODO Auto-generated method stub
		
		}

	public void mouseEntered(MouseEvent arg0)
		{
		// TODO Auto-generated method stub
		
		}

	public void mouseExited(MouseEvent arg0)
		{
		// TODO Auto-generated method stub
		
		}
	
	}
