for (int i=0; i < tools.length; i++) {
final int index = i;
final Tool tool = tools[i];
final ToggleButton button = new ToggleButton(tool.getName().replace(' ', '\n'));
ImageView icon = new ImageView(tool.getIcon());
icon.effectProperty().bind(new ObjectBinding<Effect>() {
{ bind(button.selectedProperty()); }
@Override protected Effect computeValue() {
return button.isSelected() ? null : new ColorAdjust(0, -1, 0, 0);
}
});