From e45610ece685de5bcb35b9f49d03f1de2719370a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 30 Apr 2011 21:50:26 +0200 Subject: 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 --- src/jrummikub/view/impl/StonePainter.java | 11 ----------- src/jrummikub/view/impl/Table.java | 12 +++++++++++- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src/jrummikub') diff --git a/src/jrummikub/view/impl/StonePainter.java b/src/jrummikub/view/impl/StonePainter.java index c1b6d2c..fa039f7 100644 --- a/src/jrummikub/view/impl/StonePainter.java +++ b/src/jrummikub/view/impl/StonePainter.java @@ -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++; - } - - } } diff --git a/src/jrummikub/view/impl/Table.java b/src/jrummikub/view/impl/Table.java index 23ce19d..a8c513e 100644 --- a/src/jrummikub/view/impl/Table.java +++ b/src/jrummikub/view/impl/Table.java @@ -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 : stoneSets.entrySet()) { - stonePainter.paintStoneSet(g, stoneSet.getKey(), stoneSet.getValue()); + paintStoneSet(g, stoneSet.getKey(), stoneSet.getValue()); } } } -- cgit v1.2.3