summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jrummikub/view/PlayerPanel.java4
-rw-r--r--src/jrummikub/view/Table.java16
-rw-r--r--src/jrummikub/view/resource/felt.pngbin0 -> 422022 bytes
3 files changed, 18 insertions, 2 deletions
diff --git a/src/jrummikub/view/PlayerPanel.java b/src/jrummikub/view/PlayerPanel.java
index f0416dd..b4affd0 100644
--- a/src/jrummikub/view/PlayerPanel.java
+++ b/src/jrummikub/view/PlayerPanel.java
@@ -15,7 +15,7 @@ import javax.swing.border.LineBorder;
@SuppressWarnings("serial")
public class PlayerPanel extends JPanel implements IPlayerPanel {
- private final static DecimalFormat intFormat = new DecimalFormat("00");
+ private final static DecimalFormat secondFormat = new DecimalFormat("00");
private Board board;
@@ -40,7 +40,7 @@ public class PlayerPanel extends JPanel implements IPlayerPanel {
public
void setTimeLeft(int time) {
timeBar.setValue(time);
- timeBar.setString(Integer.toString(time/60) + ":" + intFormat.format(time%60));
+ timeBar.setString(Integer.toString(time/60) + ":" + secondFormat.format(time%60));
}
diff --git a/src/jrummikub/view/Table.java b/src/jrummikub/view/Table.java
index d27c8a1..aaa1068 100644
--- a/src/jrummikub/view/Table.java
+++ b/src/jrummikub/view/Table.java
@@ -1,12 +1,16 @@
package jrummikub.view;
import java.awt.BorderLayout;
+import java.awt.Graphics;
+import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class Table extends JPanel implements ITable {
+ private final static ImageIcon background = new ImageIcon(Board.class.getResource("resource/felt.png"));
+
private JLabel leftPlayerLabel, topPlayerLabel, rightPlayerLabel;
private JPanel innerPanel;
@@ -27,6 +31,7 @@ public class Table extends JPanel implements ITable {
}
Table() {
+ super(true); // set double buffered
setLayout(new BorderLayout());
leftPlayerLabel = new JLabel();
@@ -44,4 +49,15 @@ public class Table extends JPanel implements ITable {
innerPanel.setOpaque(false);
add(innerPanel, BorderLayout.CENTER);
}
+
+ @Override
+ public void paint(Graphics g) {
+ for(int x = 0; x < getWidth(); x += background.getIconWidth()) {
+ for(int y = 0; y < getHeight(); y += background.getIconHeight()) {
+ background.paintIcon(this, g, x, y);
+ }
+ }
+
+ // TODO Rest of painting code
+ }
}
diff --git a/src/jrummikub/view/resource/felt.png b/src/jrummikub/view/resource/felt.png
new file mode 100644
index 0000000..e7b18e2
--- /dev/null
+++ b/src/jrummikub/view/resource/felt.png
Binary files differ