diff options
Diffstat (limited to 'src/jrummikub/view/impl/StoneCollectionPanel.java')
-rw-r--r-- | src/jrummikub/view/impl/StoneCollectionPanel.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/jrummikub/view/impl/StoneCollectionPanel.java b/src/jrummikub/view/impl/StoneCollectionPanel.java index 9548b3b..d74ef43 100644 --- a/src/jrummikub/view/impl/StoneCollectionPanel.java +++ b/src/jrummikub/view/impl/StoneCollectionPanel.java @@ -22,7 +22,6 @@ import jrummikub.view.IStoneCollectionPanel; class StoneCollectionPanel extends AbstractStonePanel implements IStoneCollectionPanel { private final static int INSET = 7; - private final static float STONE_SCALE = 1.1f; private Collection<Stone> selectedStones = Collections.emptyList(); @@ -30,13 +29,29 @@ class StoneCollectionPanel extends AbstractStonePanel implements * Creates a new StoneCollection instance */ StoneCollectionPanel() { - super(STONE_SCALE); - setOpaque(false); setVisible(false); setBorder(new EmptyBorder(INSET, INSET, INSET, INSET)); } + private void rescale() { + setSize(getStonePainter().getStoneWidth() * selectedStones.size() + 2 + * INSET, getStonePainter().getStoneHeight() + 2 * INSET); + } + + /** + * Sets the height to paint the collected stones in + * + * @param height + * the height in pixels + */ + void setStoneHeight(int height) { + getStonePainter().setScale(height * StonePainter.HEIGHT_SCALE); + + rescale(); + repaint(); + } + /** * Sets the stones to be shown in the collection * @@ -59,8 +74,7 @@ class StoneCollectionPanel extends AbstractStonePanel implements if (selectedStones.isEmpty()) { setVisible(false); } else { - setSize(getStonePainter().getStoneWidth() * selectedStones.size() + 2 - * INSET, getStonePainter().getStoneHeight() + 2 * INSET); + rescale(); setVisible(true); repaint(); |