Commit 70b187ae authored by Stefano Cobelli's avatar Stefano Cobelli

GUI finished, model.player package created

parent 5b100d94
......@@ -7,6 +7,8 @@
*/
package model;
import model.player.Player;
/**
* Board for the Tic Tac Toe
*
......
......@@ -10,6 +10,7 @@ package model;
import java.util.Scanner;
import model.Board.State;
import model.player.Player;
/**
* The actual game class
......
......@@ -10,6 +10,7 @@ package model;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import model.Board.State;
import model.player.Player;
import org.junit.Before;
import org.junit.Test;
......
......@@ -10,7 +10,10 @@
* @author sjc032
*
*/
package model;
package model.player;
import model.Board;
import model.Mark;
public class Player {
/** reference to the current board */
......
/**
* CSCI 205 -Software Design and Engineering
* Name(s) Stefano Cobelli
*
* Work: hw02
* Created: Nov 11, 2014, 5:53:56 PM
*/
package view;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
/**
* @author sjc032
*
*/
public class TTTControlPanel extends JPanel {
private JButton newGameButton;
private JButton trainAIButton;
private JTextField trainNumberField;
public TTTControlPanel() {
this.setLayout(new GridLayout(1, 3, 5, 5));
this.setBorder(new EmptyBorder(5, 5, 5, 5));
this.newGameButton = new JButton("New Game");
this.trainAIButton = new JButton("Train AI");
this.trainNumberField = new JTextField("10000");
String[] gameModeOptions = { "Player vs. Computer", "Player vs. Player" };
this.add(this.newGameButton);
this.add(this.trainAIButton);
this.add(this.trainNumberField);
}
/**
* @return the newGameButton
*/
public JButton getNewGameButton() {
return newGameButton;
}
/**
* @return the trainAIButton
*/
public JButton getTrainAIButton() {
return trainAIButton;
}
/**
* @return the trainNumberField
*/
public JTextField getTrainNumberField() {
return trainNumberField;
}
}
\ No newline at end of file
......@@ -26,6 +26,7 @@ public class TTTMainView extends JFrame {
/** the left side stat panel */
private TTTStatsPanel statsPanel;
private TTTPlayerPanel playerPanel;
private TTTControlPanel controlPanel;
/**
* The constructor of the frame of the GUI
......@@ -44,6 +45,8 @@ public class TTTMainView extends JFrame {
this.add(boardPanel, BorderLayout.CENTER);
this.statsPanel = new TTTStatsPanel();
this.add(statsPanel, BorderLayout.WEST);
this.controlPanel = new TTTControlPanel();
this.add(controlPanel, BorderLayout.SOUTH);
this.pack();
}
......
......@@ -13,6 +13,7 @@ import java.awt.GridLayout;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.EtchedBorder;
/**
......@@ -29,15 +30,15 @@ public class TTTPlayerPanel extends JPanel {
this.setLayout(new GridLayout(2, 2, 5, 5));
this.setBorder(new EtchedBorder(0, new Color(53, 178, 250), new Color(
73, 178, 250)));
JLabel gameModeText = new JLabel("Game Mode:");
JLabel aIText = new JLabel("Computer Player:");
JLabel gameModeText = new JLabel("Game Mode:", SwingConstants.CENTER);
JLabel aIText = new JLabel("Computer Player:", SwingConstants.CENTER);
String[] gameModeOptions = { "Player vs. Computer", "Player vs. Player" };
this.gameModeComboBox = new JComboBox(gameModeOptions);
String[] aIOptions = { "Random", "Blocker", "AI Player" };
this.aIComboBox = new JComboBox(aIOptions);
this.add(gameModeText);
this.add(aIText);
this.add(gameModeComboBox);
this.add(aIText);
this.add(aIComboBox);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment