package simogl.gui;
import javax.swing.BorderFactory;
import javax.swing.JLabel;

import javax.swing.JPanel;
import javax.swing.border.BevelBorder;
import javax.swing.border.TitledBorder;

import org.jdesktop.layout.GroupLayout;
import org.jdesktop.layout.LayoutStyle;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ResourcePanel extends JPanel
{
	private JLabel labelGold;
	private static JLabel labelFoodValue;
	private static JLabel labelInhabitansValue;
	private JLabel labelInhabitants;
	private JLabel labelFood;
	private static JLabel labelGoldValue;
	
	public ResourcePanel()
	{
		super();
		this.setFocusable(false);
		initGUI();
	}

	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout(this);
			this.setLayout(thisLayout);
			this.setPreferredSize(new java.awt.Dimension(157, 95));
			this.setBorder(BorderFactory.createTitledBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED), "Resources", TitledBorder.LEADING, TitledBorder.TOP, new java.awt.Font("Dialog",1,16)));
			{
				labelGold = new JLabel();
				labelGold.setText("Gold: ");
			}
			{
				labelGoldValue = new JLabel();
				labelGoldValue.setText("0");
			}
			{
				labelFood = new JLabel();
				labelFood.setText("Food: ");
			}
			{
				labelFoodValue = new JLabel();
				labelFoodValue.setText("0");
			}
			{
				labelInhabitants = new JLabel();
				labelInhabitants.setText("Inhabitants:");
			}
			{
				labelInhabitansValue = new JLabel();
				labelInhabitansValue.setText("0");
			}
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
			    .add(6)
			    .add(thisLayout.createParallelGroup()
			        .add(GroupLayout.LEADING, labelGold, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE)
			        .add(GroupLayout.LEADING, labelFood, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE)
			        .add(GroupLayout.LEADING, labelInhabitants, GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE))
			    .add(14)
			    .add(thisLayout.createParallelGroup()
			        .add(GroupLayout.LEADING, labelGoldValue, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
			        .add(GroupLayout.LEADING, labelFoodValue, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
			        .add(GroupLayout.LEADING, labelInhabitansValue, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE))
			    .addContainerGap(20, 20));
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
			    .add(thisLayout.createParallelGroup()
			        .add(GroupLayout.BASELINE, labelInhabitants)
			        .add(GroupLayout.BASELINE, labelInhabitansValue))
			    .addPreferredGap(LayoutStyle.RELATED)
			    .add(thisLayout.createParallelGroup()
			        .add(GroupLayout.BASELINE, labelGold)
			        .add(GroupLayout.BASELINE, labelGoldValue))
			    .addPreferredGap(LayoutStyle.RELATED)
			    .add(thisLayout.createParallelGroup()
			        .add(GroupLayout.BASELINE, labelFood)
			        .add(GroupLayout.BASELINE, labelFoodValue))
			    .add(8));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * Sets the label containing the number of inhabitants to the
	 * specified text
	 * @param label new text for inhbitants label
	 */
	public static void setLabelInhabitants(String label)
	{
		labelInhabitansValue.setText(label);
	}
	
	/**
	 * Returns the text of the inhabitants label
	 * @return text of inhabitants label
	 */
	public static String getLabelInhabitants()
	{
		return labelInhabitansValue.getText();
	}
	
	/**
	 * Sets the label containing the amount of the player's gold to the
	 * specified text
	 * @param label new text for gold label
	 */
	public static void setLabelGold(String label)
	{
		labelGoldValue.setText(label);
	}
	
	/**
	 * Returns the text of the gold label
	 * @return text of gold label
	 */
	public static String getLabelGold()
	{
		return labelGoldValue.getText();
	}
	
	/**
	 * Sets the label containing the amount of the player's food to the
	 * specified text
	 * @param label new text for food label
	 */
	public static void setLabelFood(String label)
	{
		labelFoodValue.setText(label);
	}
	
	/**
	 * Returns the text of the food label
	 * @return text of food label
	 */
	public static String getLabelFood()
	{
		return labelFoodValue.getText();
	}

}
