/**
 * @author Merv Fansler
 * @since February 25, 2015
 * @version 0.1.0
 */

package edu.millersville.cs.bitsplease.view;

import javafx.event.EventHandler;
import javafx.scene.control.ToggleButton;
import javafx.scene.input.MouseEvent;

public class ToolbarButton extends ToggleButton {

	/**
	 * @param label
	 */
	public ToolbarButton(String label) {
		super(label);
		addPersistentToggle();
		setPrefWidth(40);
		setPrefHeight(40);
		setStyle("-fx-font-size: 16");
	}

	// prevent MOUSE_PRESSED from propagating when already selected
	private void addPersistentToggle() {
		final ToolbarButton that = this;
		this.addEventFilter(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
			@Override
			public void handle(MouseEvent event) {
				if (that.isSelected())
					event.consume();
			}
		});
	}
}

@@ -21,16 +21,37 @@
 Fansler%0A
+ * @author Mike Sims%0A
  * @sinc
@@ -173,16 +173,42 @@
 andler;%0A
+import javafx.scene.Node;%0A
 import j
@@ -384,39 +384,10 @@
 ton(
-String label) %7B%0A%09%09super(label);
+)%7B
 %0A%09%09a
@@ -823,10 +823,78 @@
 %09%7D);%0A%09%7D%0A
+%09%0A%09public void setImage(Node image) %7B%0A%09%09super.setGraphic(image);%0A%09%7D%0A
 %7D%0A

Update ToolbarButton.java