Move paintStoneSet from StonePainter to Table

It's only used there, and highlighting stones is easier like this.

git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@35 72836036-5685-4462-b002-a69064685172
This commit is contained in:
Matthias Schiffer 2011-04-30 21:50:26 +02:00
parent 1b15b71a54
commit e45610ece6
2 changed files with 11 additions and 12 deletions

View file

@ -205,15 +205,4 @@ class StonePainter {
paintCircle(g, x, y, width, height);
}
public void paintStoneSet(Graphics2D g, StoneSet stoneSet, Position pos) {
float x = pos.getX();
for(Stone stone : stoneSet){
paintStone(g, stone, new Position(x, pos.getY()));
x++;
}
}
}

View file

@ -16,6 +16,7 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import jrummikub.model.Position;
import jrummikub.model.Stone;
import jrummikub.model.StoneSet;
import jrummikub.util.Event1;
import jrummikub.util.IEvent1;
@ -94,6 +95,15 @@ public class Table extends JPanel implements ITable {
});
}
public void paintStoneSet(Graphics2D g, StoneSet stoneSet, Position pos) {
float x = pos.getX();
for(Stone stone : stoneSet){
stonePainter.paintStone(g, stone, new Position(x, pos.getY()));
x++;
}
}
@Override
protected void paintComponent(Graphics g1) {
Graphics2D g = (Graphics2D) g1;
@ -108,7 +118,7 @@ public class Table extends JPanel implements ITable {
RenderingHints.VALUE_ANTIALIAS_ON);
for (Map.Entry<StoneSet, Position> stoneSet : stoneSets.entrySet()) {
stonePainter.paintStoneSet(g, stoneSet.getKey(), stoneSet.getValue());
paintStoneSet(g, stoneSet.getKey(), stoneSet.getValue());
}
}
}