summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jrummikub/view/impl/PausePanel.java9
-rw-r--r--src/jrummikub/view/impl/StartTurnPanel.java26
-rw-r--r--src/jrummikub/view/impl/View.java73
3 files changed, 56 insertions, 52 deletions
diff --git a/src/jrummikub/view/impl/PausePanel.java b/src/jrummikub/view/impl/PausePanel.java
index f9e99ad..ef7781b 100644
--- a/src/jrummikub/view/impl/PausePanel.java
+++ b/src/jrummikub/view/impl/PausePanel.java
@@ -1,5 +1,6 @@
package jrummikub.view.impl;
+import java.awt.Color;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -40,9 +41,7 @@ class PausePanel extends JPanel {
pauseLabel = new JLabel();
pauseLabel.setHorizontalAlignment(JLabel.CENTER);
- pauseLabel.setHorizontalTextPosition(JLabel.CENTER);
pauseLabel.setVerticalAlignment(JLabel.CENTER);
- pauseLabel.setVerticalTextPosition(JLabel.CENTER);
pauseLabel.putClientProperty("html.disable", Boolean.TRUE);
add(pauseLabel);
@@ -64,7 +63,11 @@ class PausePanel extends JPanel {
}
void setCurrentPlayerName(String playerName) {
- pauseLabel.setText("Der Zug von " + playerName + " ist pausiert.");
+ pauseLabel.setText(playerName + "'s Zug ist pausiert.");
+ }
+
+ void setCurrentPlayerColor(Color color) {
+ pauseLabel.setIcon(ImageUtil.createColorIcon(color, 12, 1));
}
IEvent getEndPauseEvent() {
diff --git a/src/jrummikub/view/impl/StartTurnPanel.java b/src/jrummikub/view/impl/StartTurnPanel.java
index ccbaf91..46e5f0a 100644
--- a/src/jrummikub/view/impl/StartTurnPanel.java
+++ b/src/jrummikub/view/impl/StartTurnPanel.java
@@ -1,5 +1,6 @@
package jrummikub.view.impl;
+import java.awt.Color;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -44,9 +45,7 @@ class StartTurnPanel extends JPanel {
startTurnLabel = new JLabel();
startTurnLabel.setHorizontalAlignment(JLabel.CENTER);
- startTurnLabel.setHorizontalTextPosition(JLabel.CENTER);
startTurnLabel.setVerticalAlignment(JLabel.CENTER);
- startTurnLabel.setVerticalTextPosition(JLabel.CENTER);
startTurnLabel.putClientProperty("html.disable", Boolean.TRUE);
add(startTurnLabel);
@@ -71,6 +70,10 @@ class StartTurnPanel extends JPanel {
startTurnLabel.setText(playerName + " ist jetzt an der Reihe.");
}
+ void setCurrentPlayerColor(Color color) {
+ startTurnLabel.setIcon(ImageUtil.createColorIcon(color, 12, 1));
+ }
+
void setInitialMeldError(int points) {
startTurnLabel.setText("Es wurden weniger als " + points
+ " Punkte ausgelegt.");
@@ -117,16 +120,15 @@ class StartTurnPanel extends JPanel {
}
switch (type) {
- case START_TURN_PANEL:
- startTurnButton.setText("Zug beginnen");
- buttonEvent = startTurnEvent;
- break;
- case INVALID_TURN_PANEL:
- startTurnLabel
- .setText("Es liegen ung\u00FCltige Serien auf dem Tisch.");
- startTurnButton.setText("N\u00E4chster Spieler");
- buttonEvent = acknowledgeInvalidEvent;
- break;
+ case START_TURN_PANEL:
+ startTurnButton.setText("Zug beginnen");
+ buttonEvent = startTurnEvent;
+ break;
+ case INVALID_TURN_PANEL:
+ startTurnLabel.setText("Es liegen ung\u00FCltige Serien auf dem Tisch.");
+ startTurnButton.setText("N\u00E4chster Spieler");
+ buttonEvent = acknowledgeInvalidEvent;
+ break;
}
}
diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java
index caac01f..4911de0 100644
--- a/src/jrummikub/view/impl/View.java
+++ b/src/jrummikub/view/impl/View.java
@@ -102,12 +102,12 @@ public class View extends JFrame implements IView {
public ITablePanel getTablePanel() {
return table;
}
-
+
@Override
public ISidePanel getSidePanel() {
return sidePanel;
}
-
+
@Override
public IHandPanel getHandPanel() {
return playerPanel.getHandPanel();
@@ -164,8 +164,7 @@ public class View extends JFrame implements IView {
showSettingsPanel(false);
showLoginPanel(false);
showGameListPanel(false);
- getHandPanel().setStones(
- Collections.<Pair<Stone, Position>> emptyList());
+ getHandPanel().setStones(Collections.<Pair<Stone, Position>> emptyList());
getTablePanel().setStoneSets(
Collections.<Pair<StoneSet, Position>> emptyList());
setSelectedStones(Collections.<Stone> emptyList());
@@ -330,8 +329,7 @@ public class View extends JFrame implements IView {
table = new TablePanel();
mainLayer.add(table);
- table.setBorder(new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0,
- Color.BLACK));
+ table.setBorder(new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0, Color.BLACK));
playerPanel = new PlayerPanel();
mainLayer.add(playerPanel);
@@ -380,7 +378,8 @@ public class View extends JFrame implements IView {
playerPanel.setBounds(0, tableHeight, width, playerPanelHeight);
playerPanel.rescale();
- int sideWidth = sidePanel.isVisible() ? playerPanel.getLeftPanelWidth() + 1 : 0;
+ int sideWidth = sidePanel.isVisible() ? playerPanel.getLeftPanelWidth() + 1
+ : 0;
table.setBounds(sideWidth, 0, width - sideWidth, tableHeight);
table.validate();
@@ -390,12 +389,11 @@ public class View extends JFrame implements IView {
startTurnPanel.setBounds(0, tableHeight, width, playerPanelHeight);
pausePanel.setBounds(0, tableHeight, width, playerPanelHeight);
winPanel.setBounds(0, tableHeight, width, playerPanelHeight);
-
-
- rescaleSubpanel(settingsPanel, 1 / 2.0, 1/ 2.0, 475, 300);
- rescaleSubpanel(scorePanel, 3 / 4.0, 1/ 2.0, 450, 300);
- rescaleSubpanel(loginPanel, 1 / 3.0, 1/ 3.0, 200, 200);
- rescaleSubpanel(gameListPanel, 1 / 2.0, 1/ 2.0, 475, 300);
+
+ rescaleSubpanel(settingsPanel, 1 / 2.0, 1 / 2.0, 475, 300);
+ rescaleSubpanel(scorePanel, 3 / 4.0, 1 / 2.0, 450, 300);
+ rescaleSubpanel(loginPanel, 1 / 3.0, 1 / 3.0, 200, 200);
+ rescaleSubpanel(gameListPanel, 1 / 2.0, 1 / 2.0, 475, 300);
}
private void rescaleSubpanel(JPanel sub, double widthFactor,
@@ -449,7 +447,7 @@ public class View extends JFrame implements IView {
public void showScorePanel(boolean show) {
scorePanel.setVisible(show);
}
-
+
@Override
public void showSidePanel(boolean show) {
sidePanel.setVisible(show);
@@ -476,6 +474,8 @@ public class View extends JFrame implements IView {
@Override
public void setCurrentPlayerColor(Color color) {
playerPanel.setCurrentPlayerColor(color);
+ startTurnPanel.setCurrentPlayerColor(color);
+ pausePanel.setCurrentPlayerColor(color);
}
@Override
@@ -510,24 +510,24 @@ public class View extends JFrame implements IView {
@SuppressWarnings("unchecked")
private List<Pair<Stone, Position>> createDecorationStones() {
- Pair<Stone, Position> stoneJ = new Pair<Stone, Position>(new Stone(
- -'J', StoneColor.BLACK), new Position(2.5f, 0));
- Pair<Stone, Position> stoneR = new Pair<Stone, Position>(new Stone(
- -'R', StoneColor.ORANGE), new Position(3.5f, 0));
- Pair<Stone, Position> stoneu1 = new Pair<Stone, Position>(new Stone(
- -'u', StoneColor.BLUE), new Position(4.5f, 0));
- Pair<Stone, Position> stonem1 = new Pair<Stone, Position>(new Stone(
- -'m', StoneColor.RED), new Position(5.5f, 0));
- Pair<Stone, Position> stonem2 = new Pair<Stone, Position>(new Stone(
- -'m', StoneColor.GREEN), new Position(6.5f, 0));
- Pair<Stone, Position> stonei = new Pair<Stone, Position>(new Stone(
- -'i', StoneColor.VIOLET), new Position(7.5f, 0));
- Pair<Stone, Position> stonek = new Pair<Stone, Position>(new Stone(
- -'k', StoneColor.AQUA), new Position(8.5f, 0));
- Pair<Stone, Position> stoneu2 = new Pair<Stone, Position>(new Stone(
- -'u', StoneColor.GRAY), new Position(9.5f, 0));
- Pair<Stone, Position> stoneb = new Pair<Stone, Position>(new Stone(
- -'b', StoneColor.BLACK), new Position(10.5f, 0));
+ Pair<Stone, Position> stoneJ = new Pair<Stone, Position>(new Stone(-'J',
+ StoneColor.BLACK), new Position(2.5f, 0));
+ Pair<Stone, Position> stoneR = new Pair<Stone, Position>(new Stone(-'R',
+ StoneColor.ORANGE), new Position(3.5f, 0));
+ Pair<Stone, Position> stoneu1 = new Pair<Stone, Position>(new Stone(-'u',
+ StoneColor.BLUE), new Position(4.5f, 0));
+ Pair<Stone, Position> stonem1 = new Pair<Stone, Position>(new Stone(-'m',
+ StoneColor.RED), new Position(5.5f, 0));
+ Pair<Stone, Position> stonem2 = new Pair<Stone, Position>(new Stone(-'m',
+ StoneColor.GREEN), new Position(6.5f, 0));
+ Pair<Stone, Position> stonei = new Pair<Stone, Position>(new Stone(-'i',
+ StoneColor.VIOLET), new Position(7.5f, 0));
+ Pair<Stone, Position> stonek = new Pair<Stone, Position>(new Stone(-'k',
+ StoneColor.AQUA), new Position(8.5f, 0));
+ Pair<Stone, Position> stoneu2 = new Pair<Stone, Position>(new Stone(-'u',
+ StoneColor.GRAY), new Position(9.5f, 0));
+ Pair<Stone, Position> stoneb = new Pair<Stone, Position>(new Stone(-'b',
+ StoneColor.BLACK), new Position(10.5f, 0));
Pair<Stone, Position> stone1 = new Pair<Stone, Position>(new Stone(
StoneColor.RED), new Position(2, 1));
@@ -542,9 +542,9 @@ public class View extends JFrame implements IView {
Pair<Stone, Position> stone6 = new Pair<Stone, Position>(new Stone(
StoneColor.BLACK), new Position(11, 1));
- return Arrays.asList(stoneJ, stoneR, stoneu1, stonem1, stonem2, stonei,
- stonek, stoneu2, stoneb, stone1, stone2, stone3, stone4,
- stone5, stone6);
+ return Arrays
+ .asList(stoneJ, stoneR, stoneu1, stonem1, stonem2, stonei, stonek,
+ stoneu2, stoneb, stone1, stone2, stone3, stone4, stone5, stone6);
}
@Override
@@ -564,8 +564,7 @@ public class View extends JFrame implements IView {
&& type != BottomPanelType.WIN_PANEL && type != null);
if (type == BottomPanelType.START_GAME_PANEL) {
- table.setStoneSets(Collections
- .<Pair<StoneSet, Position>> emptyList());
+ table.setStoneSets(Collections.<Pair<StoneSet, Position>> emptyList());
playerPanel.getHandPanel().setStones(createDecorationStones());
}