From 02fd2bc7059da416937beb1abe67e5ca60379030 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Tue, 1 Apr 2014 23:00:53 +0100 Subject: Settings pane now actually controls the parameters, not much left to do. --- src/jcgp/gui/console/Console.java | 11 +++++++++++ src/jcgp/gui/console/GUIConsole.java | 22 ++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 src/jcgp/gui/console/Console.java (limited to 'src/jcgp/gui/console') diff --git a/src/jcgp/gui/console/Console.java b/src/jcgp/gui/console/Console.java new file mode 100644 index 0000000..63c7f5b --- /dev/null +++ b/src/jcgp/gui/console/Console.java @@ -0,0 +1,11 @@ +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 0ef2be3..8fdb1a5 100644 --- a/src/jcgp/gui/console/GUIConsole.java +++ b/src/jcgp/gui/console/GUIConsole.java @@ -5,13 +5,15 @@ import javafx.scene.Cursor; import javafx.scene.control.TextArea; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; -import jcgp.GUI; +import jcgp.gui.GUI; -public class GUIConsole extends AnchorPane { +public class GUIConsole extends AnchorPane implements Console { private boolean dragging; private TextArea textArea = new TextArea("Welcome to JCGP!\n"); + private StringBuffer printBuffer = new StringBuffer(); + public GUIConsole() { super(); textArea.setEditable(false); @@ -87,8 +89,20 @@ public class GUIConsole extends AnchorPane { return event.getY() < (GUI.RESIZE_MARGIN); } - public TextArea getTextArea() { - return textArea; + @Override + public void println(String s) { + printBuffer.append(s + "\n"); + } + + @Override + public void print(String s) { + printBuffer.append(s); + } + + @Override + public void flush() { + textArea.appendText(printBuffer.toString()); + printBuffer = new StringBuffer(); } } -- cgit v1.2.3