From 12ebe6f6375e7db31ba1bb2eba5e3b28b51c7a19 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Sat, 15 Nov 2014 19:16:25 +0000 Subject: Added GUIHandlers file for extracted handlers, started removing parent class references from genes --- src/jcgp/gui/handlers/GUIHandlers.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/jcgp/gui/handlers/GUIHandlers.java (limited to 'src/jcgp/gui/handlers') 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 mouseEnteredHandler = new EventHandler() { + @Override + public void handle(MouseEvent event) { + ((GUIGene) event.getSource()).mouseEnter(); + } + }; + + private static final EventHandler mouseExitedHandler = new EventHandler() { + @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); + } + + +} -- cgit v1.2.3