aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/gui/console
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-05-06 14:29:37 +0100
committerEduardo Pedroni <ep625@york.ac.uk>2014-05-06 14:29:37 +0100
commit8189116ea4b5db4675e31dfd04a5687d55e29262 (patch)
treec1815021452a888f8838f1628d8fb4689777e73e /src/jcgp/gui/console
parentaa9e74e7f67789f6353fc26e02ee8e68e40609a2 (diff)
Added javadocs, made minor changes to the comments
Diffstat (limited to 'src/jcgp/gui/console')
-rw-r--r--src/jcgp/gui/console/GUIConsole.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/jcgp/gui/console/GUIConsole.java b/src/jcgp/gui/console/GUIConsole.java
index de4b378..b3d037c 100644
--- a/src/jcgp/gui/console/GUIConsole.java
+++ b/src/jcgp/gui/console/GUIConsole.java
@@ -15,12 +15,25 @@ import javafx.scene.layout.AnchorPane;
import jcgp.backend.resources.Console;
import jcgp.gui.GUI;
+/**
+ * Console pane used by the GUI to display CGP output messages.
+ * This class realises {@code Console}. It consists of a JavaFX
+ * {@code TextArea} and a {@code StringBuffer}. The buffer is filled
+ * as print messages are queued. Calling {@code flush()} writes the
+ * contents of the buffer to the {@code TextArea} and empties the buffer.
+ *
+ * @see Console
+ * @author Eduardo Pedroni
+ *
+ */
public class GUIConsole extends AnchorPane implements Console {
private TextArea textArea = new TextArea("Welcome to JCGP!\n");
-
private StringBuffer printBuffer = new StringBuffer();
+ /**
+ * Creates a new instance of this class.
+ */
public GUIConsole() {
super();
textArea.setEditable(false);
@@ -31,7 +44,10 @@ public class GUIConsole extends AnchorPane implements Console {
* This has not been fixed as of 8/4/2014.
*
* The following code modifies the EventDispatcher to consume the right mouse
- * button click, preventing the default menu from appearing.
+ * button click, preventing the default menu from appearing. It propagates the mouse
+ * click further so other elements will respond appropriately.
+ *
+ * TODO this should be refactored once the API is updated.
*/
final EventDispatcher initial = textArea.getEventDispatcher();
textArea.setEventDispatcher(new EventDispatcher() {
@@ -76,6 +92,7 @@ public class GUIConsole extends AnchorPane implements Console {
new SeparatorMenuItem(),
clearConsole));
+ // anchor the text area so it resizes automatically
AnchorPane.setTopAnchor(textArea, GUI.RESIZE_MARGIN);
AnchorPane.setBottomAnchor(textArea, 0.0);
AnchorPane.setRightAnchor(textArea, 0.0);