diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-06 01:46:10 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-06 01:46:10 +0200 |
commit | 367aa6a65cd7b593e4f3628db246e1460e25326b (patch) | |
tree | c8ac79635950bf710a255c48e49470a7e1dc90cf /src/jrummikub | |
parent | 794e3573f6d96775b76cfeb1c833d343a52d2055 (diff) | |
download | JRummikub-367aa6a65cd7b593e4f3628db246e1460e25326b.tar JRummikub-367aa6a65cd7b593e4f3628db246e1460e25326b.zip |
Make StoneCollectionPanel opaque
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@163 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub')
-rw-r--r-- | src/jrummikub/view/impl/StoneCollectionPanel.java | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/jrummikub/view/impl/StoneCollectionPanel.java b/src/jrummikub/view/impl/StoneCollectionPanel.java index 493b299..a3453d1 100644 --- a/src/jrummikub/view/impl/StoneCollectionPanel.java +++ b/src/jrummikub/view/impl/StoneCollectionPanel.java @@ -25,6 +25,8 @@ import jrummikub.view.IStoneCollectionPanel; class StoneCollectionPanel extends AbstractStonePanel implements IStoneCollectionPanel { private final static ImageIcon BACKGROUND = new ImageIcon( + HandPanel.class.getResource("/jrummikub/resource/felt.png")); + private final static ImageIcon DARK_BACKGROUND = new ImageIcon( HandPanel.class.getResource("/jrummikub/resource/dark_felt.png")); /** * The width of the border of the collection panel @@ -37,7 +39,6 @@ class StoneCollectionPanel extends AbstractStonePanel implements * Creates a new StoneCollection instance */ StoneCollectionPanel() { - setOpaque(false); setBorder(new EmptyBorder(INSET, INSET, INSET, INSET)); addComponentListener(new ComponentAdapter() { @@ -54,27 +55,9 @@ class StoneCollectionPanel extends AbstractStonePanel implements getStonePainter().setScale(height * StonePainter.HEIGHT_SCALE); repaint(); - - /* - * 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 * * @param selectedStones @@ -106,16 +89,22 @@ class StoneCollectionPanel extends AbstractStonePanel implements @Override public void paintComponent(Graphics g1) { + for (int xpos = 0; xpos < getWidth(); xpos += BACKGROUND.getIconWidth()) { + for (int ypos = 0; ypos < getHeight(); ypos += BACKGROUND.getIconHeight()) { + BACKGROUND.paintIcon(this, g1, xpos, ypos); + } + } + int width = getStonePainter().getStoneWidth() * selectedStones.size() + 2 * INSET, height = getHeight(); int x = (getWidth() - width) / 2; Graphics2D g = (Graphics2D) g1.create(x, 0, width, height); if (!selectedStones.isEmpty()) { - for (int xpos = 0; xpos < getWidth(); xpos += BACKGROUND.getIconWidth()) { - for (int ypos = 0; ypos < getHeight(); ypos += BACKGROUND + for (int xpos = 0; xpos < width; xpos += DARK_BACKGROUND.getIconWidth()) { + for (int ypos = 0; ypos < height; ypos += DARK_BACKGROUND .getIconHeight()) { - BACKGROUND.paintIcon(this, g, xpos, ypos); + DARK_BACKGROUND.paintIcon(this, g, xpos, ypos); } } |