diff options
Diffstat (limited to 'src/jcgp/gui/handlers')
-rw-r--r-- | src/jcgp/gui/handlers/GUIHandlers.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/jcgp/gui/handlers/GUIHandlers.java b/src/jcgp/gui/handlers/GUIHandlers.java new file mode 100644 index 0000000..d5b48b6 --- /dev/null +++ b/src/jcgp/gui/handlers/GUIHandlers.java @@ -0,0 +1,30 @@ +package jcgp.gui.handlers; + +import javafx.event.EventHandler; +import javafx.scene.input.MouseEvent; +import jcgp.gui.population.GUIGene; + +public class GUIHandlers { + + private static final EventHandler<MouseEvent> mouseEnteredHandler = new EventHandler<MouseEvent>() { + @Override + public void handle(MouseEvent event) { + ((GUIGene) event.getSource()).mouseEnter(); + } + }; + + private static final EventHandler<MouseEvent> mouseExitedHandler = new EventHandler<MouseEvent>() { + @Override + public void handle(MouseEvent event) { + ((GUIGene) event.getSource()).mouseExit(); + } + }; + + + public static void addHandlers(GUIGene gene) { + gene.addEventHandler(MouseEvent.MOUSE_ENTERED, mouseEnteredHandler); + gene.addEventHandler(MouseEvent.MOUSE_EXITED, mouseExitedHandler); + } + + +} |