diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2014-04-01 23:00:53 +0100 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2014-04-01 23:00:53 +0100 |
commit | 02fd2bc7059da416937beb1abe67e5ca60379030 (patch) | |
tree | 609341fe10aaa0f2dc45a1e72eba20bd24fb1281 /src/jcgp/gui/console | |
parent | a757deacded0d7357a9f68462d3f2051e16004ee (diff) |
Settings pane now actually controls the parameters, not much left to do.
Diffstat (limited to 'src/jcgp/gui/console')
-rw-r--r-- | src/jcgp/gui/console/Console.java | 11 | ||||
-rw-r--r-- | src/jcgp/gui/console/GUIConsole.java | 22 |
2 files changed, 29 insertions, 4 deletions
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(); } } |