summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/ScorePanel.java
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-30 17:37:39 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-30 17:37:39 +0200
commit5406d540d3879b8d754fc52f90501fd90efb4fb2 (patch)
treef1d3d86b346c1ec9385e10cef9a1ef6c90a842f1 /src/jrummikub/view/impl/ScorePanel.java
parent2b381670878ff8e11fcb5b06cba4948f74b18494 (diff)
downloadJRummikub-5406d540d3879b8d754fc52f90501fd90efb4fb2.tar
JRummikub-5406d540d3879b8d754fc52f90501fd90efb4fb2.zip
Show winners in score panel
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@322 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view/impl/ScorePanel.java')
-rw-r--r--src/jrummikub/view/impl/ScorePanel.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/jrummikub/view/impl/ScorePanel.java b/src/jrummikub/view/impl/ScorePanel.java
index 8947d17..39ae285 100644
--- a/src/jrummikub/view/impl/ScorePanel.java
+++ b/src/jrummikub/view/impl/ScorePanel.java
@@ -2,12 +2,15 @@ package jrummikub.view.impl;
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
+import java.awt.image.BufferedImage;
import java.util.Iterator;
import javax.swing.Box;
+import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
@@ -20,6 +23,11 @@ import jrummikub.view.IScorePanel;
@SuppressWarnings("serial")
class ScorePanel extends JPanel implements IScorePanel {
+ private final static ImageIcon STAR_ICON = new ImageIcon(
+ ScorePanel.class.getResource("/jrummikub/resource/star.png"));
+ private final static ImageIcon EMPTY_ICON = new ImageIcon(new BufferedImage(
+ 16, 16, BufferedImage.TYPE_INT_ARGB));
+
private Iterable<PlayerSettings> players;
private Iterable<Score> scores;
private Score accumulatedScore;
@@ -136,7 +144,10 @@ class ScorePanel extends JPanel implements IScorePanel {
c.gridwidth = GridBagConstraints.REMAINDER;
}
+ boolean won = score.getWinners().get(i);
JLabel scoreLabel = new JLabel(Integer.toString(score.getPoints().get(i)));
+ scoreLabel.setIcon(won ? STAR_ICON : EMPTY_ICON);
+ scoreLabel.setFont(scoreLabel.getFont().deriveFont(won ? Font.BOLD : 0));
scoreLabel.setHorizontalAlignment(JLabel.CENTER);
innerPanel.add(scoreLabel, c);
}
@@ -160,8 +171,11 @@ class ScorePanel extends JPanel implements IScorePanel {
c.gridwidth = GridBagConstraints.REMAINDER;
}
+ boolean won = accumulatedScore.getWinners().get(i);
JLabel scoreLabel = new JLabel(Integer.toString(accumulatedScore
.getPoints().get(i)));
+ scoreLabel.setIcon(won ? STAR_ICON : EMPTY_ICON);
+ scoreLabel.setFont(scoreLabel.getFont().deriveFont(won ? Font.BOLD : 0));
scoreLabel.setHorizontalAlignment(JLabel.CENTER);
innerPanel.add(scoreLabel, c);
}