summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/WinPanel.java
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-10 03:37:34 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-10 03:37:34 +0200
commit4a860e53cf6f2f97f18785673399498609e6504b (patch)
tree4c0c8dd81390bb306139f38269779d3967d93980 /src/jrummikub/view/impl/WinPanel.java
parenta64492dc4b7a08f0d976da10e2da455c20767fd5 (diff)
downloadJRummikub-4a860e53cf6f2f97f18785673399498609e6504b.tar
JRummikub-4a860e53cf6f2f97f18785673399498609e6504b.zip
Set correct player names :)
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@212 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view/impl/WinPanel.java')
-rw-r--r--src/jrummikub/view/impl/WinPanel.java19
1 files changed, 14 insertions, 5 deletions
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));
}
}