Remove color toggle button margins
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@347 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
061e7ab305
commit
0e9bf5c52d
2 changed files with 10 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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<StoneColor, Map<Integer, BufferedImage>> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue