aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui/console
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-04-06 21:58:53 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-04-06 21:58:53 +0100
commite6dd7711c7dad5e000445208eb5845801f4ccffc (patch)
tree1454bd20a8dd7069b1283184c42f4def6d5f7e6f /src/jcgp/gui/console
parentc7969623b44f375e30fa3f15dcd7581609276a0f (diff)
About to make big changes to the way fitness works, committing just in case
Diffstat (limited to 'src/jcgp/gui/console')
-rw-r--r--src/jcgp/gui/console/Console.java11
-rw-r--r--src/jcgp/gui/console/GUIConsole.java63
2 files changed, 1 insertions, 73 deletions
diff --git a/src/jcgp/gui/console/Console.java b/src/jcgp/gui/console/Console.java
deleted file mode 100644
index 63c7f5b..0000000
--- a/src/jcgp/gui/console/Console.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package jcgp.gui.console;
-
-public interface Console {
-
- public void println(String s);
-
- public void print(String s);
-
- public void flush();
-
-}
diff --git a/src/jcgp/gui/console/GUIConsole.java b/src/jcgp/gui/console/GUIConsole.java
index d8625f5..694f1a5 100644
--- a/src/jcgp/gui/console/GUIConsole.java
+++ b/src/jcgp/gui/console/GUIConsole.java
@@ -1,15 +1,12 @@
package jcgp.gui.console;
-import javafx.event.EventHandler;
-import javafx.scene.Cursor;
import javafx.scene.control.TextArea;
-import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
+import jcgp.backend.resources.Console;
import jcgp.gui.GUI;
public class GUIConsole extends AnchorPane implements Console {
- private boolean dragging;
private TextArea textArea = new TextArea("Welcome to JCGP!");
private StringBuffer printBuffer = new StringBuffer();
@@ -18,8 +15,6 @@ public class GUIConsole extends AnchorPane implements Console {
super();
textArea.setEditable(false);
- setResizeListeners();
-
AnchorPane.setTopAnchor(textArea, GUI.RESIZE_MARGIN);
AnchorPane.setBottomAnchor(textArea, 0.0);
AnchorPane.setRightAnchor(textArea, 0.0);
@@ -32,62 +27,6 @@ public class GUIConsole extends AnchorPane implements Console {
}
- /**
- *
- */
- private void setResizeListeners() {
- setOnMousePressed(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- // ignore clicks outside of the draggable margin
- if(isInDraggableZone(event)) {
- dragging = true;
- }
- }
- });
- setOnMouseDragged(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- if(dragging) {
- double newHeight = getHeight() - event.getY();
- if (newHeight >= getMinHeight()) {
- setPrefHeight(newHeight);
- } else {
- setPrefHeight(getMinHeight());
- }
- }
- }
- });
- setOnMouseMoved(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- if(isInDraggableZone(event) || dragging) {
- setCursor(Cursor.V_RESIZE);
- }
- else {
- setCursor(Cursor.DEFAULT);
- }
- }
- });
- setOnMouseReleased(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- dragging = false;
- setCursor(Cursor.DEFAULT);
- }
- });
- textArea.setOnMouseEntered(new EventHandler<MouseEvent>() {
- @Override
- public void handle(MouseEvent event) {
- setCursor(Cursor.DEFAULT);
- }
- });
- }
-
- private boolean isInDraggableZone(MouseEvent event) {
- return event.getY() < (GUI.RESIZE_MARGIN);
- }
-
@Override
public void println(String s) {
printBuffer.append("\n" + s);