summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jrummikub/control/RoundControl.java4
-rw-r--r--src/jrummikub/model/GameState.java8
-rw-r--r--src/jrummikub/view/impl/StartTurnPanel.java2
-rw-r--r--src/jrummikub/view/impl/View.java1
-rw-r--r--src/jrummikub/view/impl/WinPanel.java19
5 files changed, 22 insertions, 12 deletions
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java
index 63accaa..490873a 100644
--- a/src/jrummikub/control/RoundControl.java
+++ b/src/jrummikub/control/RoundControl.java
@@ -53,11 +53,11 @@ public class RoundControl {
view.enableStartTurnPanel(true);
view.getTablePanel().setStoneSets(clonedTable);
view.setCurrentPlayerName(gameState.getActivePlayer().getName());
- view.getTablePanel().setRightPlayerName(
+ view.getTablePanel().setLeftPlayerName(
gameState.getNthNextPlayer(1).getName());
view.getTablePanel().setTopPlayerName(
gameState.getNthNextPlayer(2).getName());
- view.getTablePanel().setLeftPlayerName(
+ view.getTablePanel().setRightPlayerName(
gameState.getNthNextPlayer(3).getName());
}
diff --git a/src/jrummikub/model/GameState.java b/src/jrummikub/model/GameState.java
index 1f0ef29..6f1bad3 100644
--- a/src/jrummikub/model/GameState.java
+++ b/src/jrummikub/model/GameState.java
@@ -14,10 +14,10 @@ public class GameState implements IGameState {
public GameState() {
table = new Table();
players = new ArrayList<Player>();
- players.add(new Player("Player 1", Color.RED));
- players.add(new Player("Player 2", Color.YELLOW));
- players.add(new Player("Player 3", Color.GREEN));
- players.add(new Player("Player 4", Color.BLACK));
+ players.add(new Player("Ida", Color.RED));
+ players.add(new Player("Matthias", Color.YELLOW));
+ players.add(new Player("Jannis", Color.GREEN));
+ players.add(new Player("Bennet", Color.BLACK));
activePlayer = 0;
gameHeap = new StoneHeap();
}
diff --git a/src/jrummikub/view/impl/StartTurnPanel.java b/src/jrummikub/view/impl/StartTurnPanel.java
index ee94347..871a615 100644
--- a/src/jrummikub/view/impl/StartTurnPanel.java
+++ b/src/jrummikub/view/impl/StartTurnPanel.java
@@ -69,7 +69,7 @@ class StartTurnPanel extends JPanel {
* the player name
*/
void setCurrentPlayerName(String playerName) {
- startTurnLabel.setText("'" + playerName + "' ist jetzt an der Reihe.");
+ startTurnLabel.setText(playerName + " ist jetzt an der Reihe.");
}
/**
diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java
index 5697cb6..4fc897c 100644
--- a/src/jrummikub/view/impl/View.java
+++ b/src/jrummikub/view/impl/View.java
@@ -121,6 +121,7 @@ public class View extends JFrame implements IView {
public void setCurrentPlayerName(String playerName) {
playerPanel.setCurrentPlayerName(playerName);
startTurnPanel.setCurrentPlayerName(playerName);
+ winPanel.setCurrentPlayerName(playerName);
}
@Override
diff --git a/src/jrummikub/view/impl/WinPanel.java b/src/jrummikub/view/impl/WinPanel.java
index 45cc878..8cfe458 100644
--- a/src/jrummikub/view/impl/WinPanel.java
+++ b/src/jrummikub/view/impl/WinPanel.java
@@ -40,7 +40,7 @@ public class WinPanel extends JPanel {
setBorder(new EmptyBorder(PANEL_INSET, PANEL_INSET, PANEL_INSET,
PANEL_INSET));
- winLabel = new JLabel("Du hast gewonnen!");
+ winLabel = new JLabel();
winLabel.setHorizontalAlignment(JLabel.CENTER);
winLabel.setHorizontalTextPosition(JLabel.CENTER);
winLabel.setVerticalAlignment(JLabel.CENTER);
@@ -74,6 +74,16 @@ public class WinPanel extends JPanel {
}
/**
+ * Sets the name of the current player
+ *
+ * @param name
+ * the player name
+ */
+ void setCurrentPlayerName(String name) {
+ winLabel.setText("Du hast gewonnen, " + name + "!");
+ }
+
+ /**
* The new game event is emitted when the player wants to start a new game
*
* @return the event
@@ -94,8 +104,7 @@ public class WinPanel extends JPanel {
private void rescale() {
Insets insets = getInsets();
int x = insets.left, y = insets.top, width = getWidth() - insets.left
- - insets.right, height = getHeight() - insets.top
- - insets.bottom;
+ - insets.right, height = getHeight() - insets.top - insets.bottom;
if (width > PANEL_MAX_WIDTH) {
x += (width - PANEL_MAX_WIDTH) / 4;
@@ -114,8 +123,8 @@ public class WinPanel extends JPanel {
buttonWidth, buttonHeight);
newGameButton.setFont(newGameButton.getFont().deriveFont(fontSize));
- quitButton.setBounds(x + buttonWidth + PANEL_SEPARATOR, y
- + firstLineHeight + PANEL_SEPARATOR, buttonWidth, buttonHeight);
+ quitButton.setBounds(x + buttonWidth + PANEL_SEPARATOR, y + firstLineHeight
+ + PANEL_SEPARATOR, buttonWidth, buttonHeight);
quitButton.setFont(quitButton.getFont().deriveFont(fontSize));
}
}