diff options
Diffstat (limited to 'src/jrummikub/view/Table.java')
-rw-r--r-- | src/jrummikub/view/Table.java | 16 |
1 files changed, 16 insertions, 0 deletions
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 + } } |