From 8189116ea4b5db4675e31dfd04a5687d55e29262 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Tue, 6 May 2014 14:29:37 +0100 Subject: Added javadocs, made minor changes to the comments --- src/jcgp/gui/console/GUIConsole.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/jcgp/gui/console/GUIConsole.java') 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); -- cgit v1.2.3