package com.google.code.timetrail.gui;
import javax.swing.JPanel;
import javax.swing.JLabel;
import com.google.code.timetrail.backend.Control;
import com.google.code.timetrail.gui.SaveGameFrame;
import com.google.code.timetrail.gui.TakingMoveFrame;
import com.google.code.timetrail.presenter.InventoryFrameBackend;
import javax.swing.JButton;
import java.awt.CardLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.IOException;
public class InventoryFrame extends JPanel{
private static final long serialVersionUID = -347067181019755270L;
private InventoryFrameBackend invFrameBackend;
private Control gameControl;
private JPanel myCD;
public InventoryFrame(Control control, JPanel cd) {
this.gameControl = control;
invFrameBackend = new InventoryFrameBackend(gameControl);
this.myCD = cd;
JLabel lblInventory = new JLabel(invFrameBackend.getTitle());
lblInventory.setBounds(36, 11, 48, 14);
JLabel lblMoney = new JLabel(invFrameBackend.getMoneyLabel());
lblMoney.setBounds(36, 43, 95, 14);
JLabel lblHullParts = new JLabel(invFrameBackend.getHullPartsLabel());
lblHullParts.setBounds(36, 70, 95, 14);
JLabel lblTimeBullets = new JLabel(invFrameBackend.getTimeBulletsLabel());
lblTimeBullets.setBounds(36, 95, 95, 14);
JLabel lblTimeSuits = new JLabel(invFrameBackend.getTimeSuitsLabel());
lblTimeSuits.setBounds(36, 120, 95, 14);
JLabel lblEngines = new JLabel(invFrameBackend.getEnginesLabel());
lblEngines.setBounds(36, 145, 95, 14);
JLabel lblFluxCapacitor = new JLabel(invFrameBackend.getFCapacitorLabel());
lblFluxCapacitor.setBounds(36, 170, 95, 14);
JLabel lblFood = new JLabel(invFrameBackend.getFoodLabel());
lblFood.setBounds(36, 195, 95, 14);
JLabel lblFuelCells = new JLabel(invFrameBackend.getFuelCellsLabel());
lblFuelCells.setBounds(36, 220, 95, 14);
JLabel lblMoneyAmount = new JLabel(invFrameBackend.getMoneyAmount());
lblMoneyAmount.setBounds(141, 43, 46, 14);
JLabel lblHullPartsAmount = new JLabel(invFrameBackend.getHullPartsAmount());
lblHullPartsAmount.setBounds(141, 70, 46, 14);
JLabel lblTimeBulletsAmount = new JLabel(invFrameBackend.getTimeBulletsAmount());
lblTimeBulletsAmount.setBounds(141, 95, 46, 14);
JLabel lblTimeSuitsAmount = new JLabel(invFrameBackend.getTimeSuitsAmount());
lblTimeSuitsAmount.setBounds(141, 120, 46, 14);
JLabel lblEnginesAmount = new JLabel(invFrameBackend.getEnginesAmount());
lblEnginesAmount.setBounds(141, 145, 46, 14);
JLabel lblFCapacitorAmount = new JLabel(invFrameBackend.getFCapacitorAmount());
lblFCapacitorAmount.setBounds(141, 170, 46, 14);
JLabel lblFoodAmount = new JLabel(invFrameBackend.getFoodAmount());
lblFoodAmount.setBounds(141, 195, 46, 14);
JLabel lblFuelCellAmount = new JLabel(invFrameBackend.getFuelCellsAmount());
lblFuelCellAmount.setBounds(141, 220, 46, 14);
JLabel lblPlayer = new JLabel(invFrameBackend.getPlayer(1));
lblPlayer.setBounds(274, 43, 166, 14);
JLabel lblPstatus = new JLabel(invFrameBackend.getPlayerStatus(1));
lblPstatus.setBounds(295, 63, 114, 14);
JLabel lblPlayer_1 = new JLabel(invFrameBackend.getPlayer(2));
lblPlayer_1.setBounds(274, 88, 114, 14);
setLayout(null);
add(lblInventory);
add(lblHullParts);
add(lblHullPartsAmount);
add(lblPstatus);
add(lblTimeSuits);
add(lblTimeSuitsAmount);
add(lblEngines);
add(lblEnginesAmount);
add(lblFluxCapacitor);
add(lblFCapacitorAmount);
add(lblFood);
add(lblFoodAmount);
add(lblFuelCells);
add(lblFuelCellAmount);
add(lblMoney);
add(lblMoneyAmount);
add(lblTimeBullets);
add(lblTimeBulletsAmount);
add(lblPlayer_1);
add(lblPlayer);
JLabel lblPstatus_1 = new JLabel(invFrameBackend.getPlayerStatus(2));
lblPstatus_1.setBounds(295, 108, 114, 14);
add(lblPstatus_1);
JLabel lblPlayer_2 = new JLabel(invFrameBackend.getPlayer(3));
lblPlayer_2.setBounds(274, 133, 114, 14);
add(lblPlayer_2);
JLabel lblPstatus_2 = new JLabel(invFrameBackend.getPlayerStatus(3));
lblPstatus_2.setBounds(295, 157, 46, 14);
add(lblPstatus_2);
JLabel lblPlayer_3 = new JLabel(invFrameBackend.getPlayer(4));
lblPlayer_3.setBounds(274, 182, 114, 14);
add(lblPlayer_3);
JLabel lblPstatus_3 = new JLabel(invFrameBackend.getPlayerStatus(4));
lblPstatus_3.setBounds(295, 207, 114, 14);
add(lblPstatus_3);
JLabel lblNewLabel = new JLabel(invFrameBackend.getPlayer(5));
lblNewLabel.setBounds(274, 230, 114, 14);
add(lblNewLabel);
JLabel lblPstatus_4 = new JLabel(invFrameBackend.getPlayerStatus(5));
lblPstatus_4.setBounds(295, 255, 114, 14);
add(lblPstatus_4);
JButton button = new JButton(invFrameBackend.getBackButtonText());
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
myCD.add(new TakingMoveFrame(gameControl, myCD, "Inventory"), "TakeMove");
CardLayout cd = (CardLayout) myCD.getLayout();
cd.last(myCD);
}
});
button.setBounds(36, 277, 89, 23);
add(button);
JButton btnSavebutton = new JButton(invFrameBackend.getSaveButtonText());
btnSavebutton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
myCD.add(new SaveGameFrame(gameControl, myCD), "TakeMove");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
CardLayout cd = (CardLayout) myCD.getLayout();
cd.last(myCD);
}
});
btnSavebutton.setBounds(141, 277, 89, 23);
add(btnSavebutton);
JButton skillsButton = new JButton(invFrameBackend.getSkillsButtonText());
skillsButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
myCD.add(new SkillFrame(gameControl, myCD), "Inv");
CardLayout cd = (CardLayout) myCD.getLayout();
cd.last(myCD);
}
});
skillsButton.setBounds(36, 246, 89, 23);
add(skillsButton);
}
}