diff options
Diffstat (limited to 'src/jrummikub/view/Board.java')
-rw-r--r-- | src/jrummikub/view/Board.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/jrummikub/view/Board.java b/src/jrummikub/view/Board.java index d0a3173..5fc0390 100644 --- a/src/jrummikub/view/Board.java +++ b/src/jrummikub/view/Board.java @@ -2,6 +2,7 @@ package jrummikub.view; import java.awt.Color; import java.awt.Graphics; +import java.awt.Insets; import javax.swing.ImageIcon; import javax.swing.JPanel; @@ -21,8 +22,15 @@ public class Board extends JPanel implements IBoard { @Override protected void paintComponent(Graphics g) { - for(int x = 0; x < getWidth(); x += background.getIconWidth()) { - background.paintIcon(this, g, x, 0); + Insets insets = getInsets(); + int x = insets.left, y = insets.top, width = getWidth()-insets.left-insets.right, height = getHeight()-insets.top-insets.bottom; + g = g.create(x, y, width, height); + + for(int xpos = 0; xpos < width; xpos += background.getIconWidth()) { + background.paintIcon(this, g, xpos, 0); + } + for(int xpos = -32; xpos < width; xpos += background.getIconWidth()) { + background.paintIcon(this, g, xpos, 75); } // TODO Rest of painting code |