summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/Board.java
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-04-29 01:16:25 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-04-29 01:16:25 +0200
commit5a0be3261a52f6a0849941283487d08212a35983 (patch)
tree4c2d808cb69ca28e0fa8d61d30330fa631fe5207 /src/jrummikub/view/Board.java
parent5a7118587f26c6cb54b7d7771fda4a96747e492a (diff)
downloadJRummikub-5a0be3261a52f6a0849941283487d08212a35983.tar
JRummikub-5a0be3261a52f6a0849941283487d08212a35983.zip
Fix some off-by-one painting problems
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@15 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view/Board.java')
-rw-r--r--src/jrummikub/view/Board.java12
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