From 0e9bf5c52d9542208bd8f23e57901b1d3844dd68 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 31 May 2011 05:00:22 +0200 Subject: Remove color toggle button margins git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@347 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/view/impl/SettingsPanel.java | 1 + src/jrummikub/view/impl/StonePainter.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/jrummikub') diff --git a/src/jrummikub/view/impl/SettingsPanel.java b/src/jrummikub/view/impl/SettingsPanel.java index 3f577cc..4374640 100644 --- a/src/jrummikub/view/impl/SettingsPanel.java +++ b/src/jrummikub/view/impl/SettingsPanel.java @@ -330,6 +330,7 @@ class SettingsPanel extends JPanel implements ISettingsPanel { private void createColorButton(final StoneColor color) { JToggleButton button = new JToggleButton(ImageUtil.createColorIcon( StonePainter.getColor(color), 12, 1)); + button.setMargin(new Insets(0, 0, 0, 0)); button.addChangeListener(new ChangeListener() { @Override diff --git a/src/jrummikub/view/impl/StonePainter.java b/src/jrummikub/view/impl/StonePainter.java index 6b7e402..09b6dcc 100644 --- a/src/jrummikub/view/impl/StonePainter.java +++ b/src/jrummikub/view/impl/StonePainter.java @@ -159,8 +159,8 @@ class StonePainter { return img; } - private BufferedImage getStoneImage(StoneColor color, int value, boolean selected, - boolean hovered) { + private BufferedImage getStoneImage(StoneColor color, int value, + boolean selected, boolean hovered) { Map> stoneMap; if (selected) { @@ -311,7 +311,8 @@ class StonePainter { g.setFont(new Font("SansSerif", Font.BOLD, r.height / 4)); FontMetrics fm = g.getFontMetrics(); - String value = (v > 0) ? Integer.toString(v) : Character.toString((char)(-v)); + String value = (v > 0) ? Integer.toString(v) : Character + .toString((char) (-v)); Rectangle2D stringRect = fm.getStringBounds(value, g); if (scale > 1) { @@ -359,10 +360,12 @@ class StonePainter { int x = Math.round(p.getX() * width), y = Math.round(p.getY() * height); if (stone.isJoker()) { - g.drawImage(getStoneImage(stone.getColor(), 0, selected, hovered), x, y, null); - } else { - g.drawImage(getStoneImage(stone.getColor(), stone.getValue(), selected, hovered), x, y, + g.drawImage(getStoneImage(stone.getColor(), 0, selected, hovered), x, y, null); + } else { + g.drawImage( + getStoneImage(stone.getColor(), stone.getValue(), selected, hovered), + x, y, null); } } } -- cgit v1.2.3