summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/Board.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/view/impl/Board.java')
-rw-r--r--src/jrummikub/view/impl/Board.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/jrummikub/view/impl/Board.java b/src/jrummikub/view/impl/Board.java
index dc26dd4..2e02f75 100644
--- a/src/jrummikub/view/impl/Board.java
+++ b/src/jrummikub/view/impl/Board.java
@@ -2,7 +2,9 @@ package jrummikub.view.impl;
import java.awt.Color;
import java.awt.Graphics;
+import java.awt.Graphics2D;
import java.awt.Insets;
+import java.awt.RenderingHints;
import java.util.Collections;
import java.util.Map;
@@ -18,6 +20,7 @@ public class Board extends JPanel implements IBoard {
private final static ImageIcon background = new ImageIcon(Board.class.getResource("/jrummikub/resource/wood.png"));
private Map<Stone, Position> stones = Collections.emptyMap();
+ private StonePainter stonePainter = new StonePainter(StonePainter.BOARD_SCALE);
Board() {
super(true);
@@ -26,10 +29,10 @@ public class Board extends JPanel implements IBoard {
}
@Override
- protected void paintComponent(Graphics g) {
+ protected void paintComponent(Graphics g1) {
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);
+ Graphics2D g = (Graphics2D)g1.create(x, y, width, height);
for(int xpos = 0; xpos < width; xpos += background.getIconWidth()) {
background.paintIcon(this, g, xpos, 0);
@@ -38,8 +41,11 @@ public class Board extends JPanel implements IBoard {
background.paintIcon(this, g, xpos, 75);
}
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
for (Map.Entry<Stone, Position> stone : stones.entrySet()) {
- StonePainter.paintStone(g, stone.getKey(), stone.getValue(), StonePainter.BOARD_SCALE);
+ stonePainter.paintStone(g, stone.getKey(), stone.getValue());
}
}