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) {
|
private void createColorButton(final StoneColor color) {
|
||||||
JToggleButton button = new JToggleButton(ImageUtil.createColorIcon(
|
JToggleButton button = new JToggleButton(ImageUtil.createColorIcon(
|
||||||
StonePainter.getColor(color), 12, 1));
|
StonePainter.getColor(color), 12, 1));
|
||||||
|
button.setMargin(new Insets(0, 0, 0, 0));
|
||||||
button.addChangeListener(new ChangeListener() {
|
button.addChangeListener(new ChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -159,8 +159,8 @@ class StonePainter {
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BufferedImage getStoneImage(StoneColor color, int value, boolean selected,
|
private BufferedImage getStoneImage(StoneColor color, int value,
|
||||||
boolean hovered) {
|
boolean selected, boolean hovered) {
|
||||||
Map<StoneColor, Map<Integer, BufferedImage>> stoneMap;
|
Map<StoneColor, Map<Integer, BufferedImage>> stoneMap;
|
||||||
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
|
@ -311,7 +311,8 @@ class StonePainter {
|
||||||
|
|
||||||
g.setFont(new Font("SansSerif", Font.BOLD, r.height / 4));
|
g.setFont(new Font("SansSerif", Font.BOLD, r.height / 4));
|
||||||
FontMetrics fm = g.getFontMetrics();
|
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);
|
Rectangle2D stringRect = fm.getStringBounds(value, g);
|
||||||
|
|
||||||
if (scale > 1) {
|
if (scale > 1) {
|
||||||
|
@ -359,10 +360,12 @@ class StonePainter {
|
||||||
int x = Math.round(p.getX() * width), y = Math.round(p.getY() * height);
|
int x = Math.round(p.getX() * width), y = Math.round(p.getY() * height);
|
||||||
|
|
||||||
if (stone.isJoker()) {
|
if (stone.isJoker()) {
|
||||||
g.drawImage(getStoneImage(stone.getColor(), 0, selected, hovered), x, y, null);
|
g.drawImage(getStoneImage(stone.getColor(), 0, selected, hovered), x, y,
|
||||||
} else {
|
|
||||||
g.drawImage(getStoneImage(stone.getColor(), stone.getValue(), selected, hovered), x, y,
|
|
||||||
null);
|
null);
|
||||||
|
} else {
|
||||||
|
g.drawImage(
|
||||||
|
getStoneImage(stone.getColor(), stone.getValue(), selected, hovered),
|
||||||
|
x, y, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue