package com.traxel.lumbermill.log;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import javax.swing.Icon;
private static final int WIDTH = 20;
private static final int HEIGHT = 14;
private boolean _active = false;
return _active;
}
public void setActive(
final boolean active) {
_active = active;
}
@Override
return WIDTH;
}
@Override
return HEIGHT;
}
static class PlayIcon extends ActiveStateIcon {
@Override
public void paintIcon(
final Component c,
final Graphics g,
final int x,
final int y) {
final int[] xs;
final int[] ys;
if (isActive()) {
g.setColor(Color.GREEN);
} else {
g.setColor(c.getBackground());
}
g.fillRect(x, y, WIDTH, HEIGHT);
xs = new int[3];
ys = new int[3];
xs[0] = x + 2;
ys[0] = y + 2;
xs[1] = x + WIDTH - 2;
ys[1] = y + (HEIGHT / 2);
xs[2] = x + 2;
ys[2] = y + HEIGHT - 2;
g.setColor(Color.BLACK);
g.fillPolygon(xs, ys, 3);
}
}
static class PauseIcon extends ActiveStateIcon {
@Override
public void paintIcon(
final Component c,
final Graphics g,
final int x,
final int y) {
if (isActive()) {
g.setColor(Color.RED);
} else {
g.setColor(c.getBackground());
}
g.fillRect(x, y, WIDTH, HEIGHT);
g.setColor(Color.BLACK);
g.fillRect(x + 4, y + 2, 5, HEIGHT - 4);
g.fillRect(x + WIDTH - 4 - 5, y + 2,
5, HEIGHT - 4);
}
}
static class StopIcon extends ActiveStateIcon {
@Override
public void paintIcon(
final Component c,
final Graphics g,
final int x,
final int y) {
if (isActive()) {
g.setColor(Color.RED);
} else {
g.setColor(c.getBackground());
}
g.fillRect(x, y, WIDTH, HEIGHT);
g.setColor(Color.BLACK);
g.fillRect(x + 4, y + 2,
WIDTH
- 8, HEIGHT
- 4);
}
}
static class ClearIcon extends ActiveStateIcon {
@Override
public void paintIcon(
final Component c,
final Graphics g,
final int x,
final int y) {
g.setColor(Color.BLACK);
g.drawLine(x + 1, y + 1, x + WIDTH - 6, y + HEIGHT - 1);
g.drawLine(x + 2, y + 1, x + WIDTH - 5, y + HEIGHT - 1);
g.drawLine(x + 5, y + 1, x + WIDTH - 2, y + HEIGHT - 1);
g.drawLine(x + 6, y + 1, x + WIDTH - 1, y + HEIGHT - 1);
g.drawLine(x + WIDTH - 6, y + 1, x + 1, y + HEIGHT - 1);
g.drawLine(x + WIDTH - 5, y + 1, x + 2, y + HEIGHT - 1);
g.drawLine(x + WIDTH - 2, y + 1, x + 5, y + HEIGHT - 1);
g.drawLine(x + WIDTH - 1, y + 1, x + 6, y + HEIGHT - 1);
g.setColor(Color.RED);
g.drawLine(x + 3, y + 1, x + WIDTH - 4, y + HEIGHT - 1);
g.drawLine(x + 4, y + 1, x + WIDTH - 3, y + HEIGHT - 1);
g.drawLine(x + WIDTH - 4, y + 1, x + 3, y + HEIGHT - 1);
g.drawLine(x + WIDTH - 3, y + 1, x + 4, y + HEIGHT - 1);
}
}
}