import java.awt.*;
import javax.swing.*;

/**
 * A simple yard marker for a football scoreboard
 *
 * @version 1.0
 * @author  Prof. David Benrstein, James Madison University
 */
public class YardMarker extends JPanel
{
    private int          down,  toGo,  yard;
    private JLabel       downL, sideL, toGoL, yardL;
    private String       side;
    

    /**
     * Default Constructor
     */
    public YardMarker()
    {
	super();

	downL = new JLabel();
	sideL = new JLabel();
	toGoL = new JLabel();
	yardL = new JLabel();

	performLayout();
    }

    
    /**
     * Returns the current down
     */
    public int getDown()
    {
	return down;
    }

    /**
     * Returns the current side of the field the
     * ball is on
     */
    public String getSide()
    {
	return side;
    }

    /**
     * Returns the current yards to go for a first down
     */
    public int getToGo()
    {
	return toGo;
    }

    /**
     * Returns the current position of the ball
     */
    public int getYard()
    {
	return yard;
    }


    /**
     * Layout this component
     */
    private void performLayout()
    {
	setLayout(new GridLayout(1,7));

	add(new JLabel("Down: "));
	downL.setForeground(Color.BLUE);
	add(downL);

	add(new JLabel("To Go: "));
	toGoL.setForeground(Color.BLUE);
	add(toGoL);

	add(new JLabel("On: "));
	sideL.setForeground(Color.BLUE);
	add(sideL);
	yardL.setForeground(Color.BLUE);
	add(yardL);
    }


    /**
     * Set the current values
     */
    public void setValues(int down, int toGo, String side, int yard)
    {
	this.down = down;
	this.toGo = toGo;
	this.side = side;
	this.yard = yard;

	downL.setText(""+down);
	toGoL.setText(""+toGo);
	sideL.setText(side);
	yardL.setText(""+yard);
    }
}
