diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-03 21:55:14 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-03 21:55:14 +0200 |
commit | a274c2b02ed0a5baa6da61d36f4d16e7b10d3dc1 (patch) | |
tree | 2b4ba53518d8e329fb4aa3fcdbe553a990560d5e /src/jrummikub/view/impl/StoneCollectionPanel.java | |
parent | 51f70cafe316a1284db82a4cfb3c09cba8c12293 (diff) | |
download | JRummikub-a274c2b02ed0a5baa6da61d36f4d16e7b10d3dc1.tar JRummikub-a274c2b02ed0a5baa6da61d36f4d16e7b10d3dc1.zip |
Rescale collection; add bottom margin to table for collection
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@99 72836036-5685-4462-b002-a69064685172
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(); |