aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/GUI.java
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2014-03-26 21:34:37 +0000
committerEduardo Pedroni <ep625@york.ac.uk>2014-03-26 21:34:37 +0000
commit2bf2d3ac2c578de481ecfd545d58be73c5628996 (patch)
treeec47cfeedaed5bf677cab1bc9e910782369fe127 /src/jcgp/GUI.java
parentbc4fafb9d3c60993253f7e78c10338c901de653a (diff)
Node grid has been refactored a few times, settings pane is almost complete, console is all done.
Diffstat (limited to 'src/jcgp/GUI.java')
-rw-r--r--src/jcgp/GUI.java85
1 files changed, 45 insertions, 40 deletions
diff --git a/src/jcgp/GUI.java b/src/jcgp/GUI.java
index 669a4e2..a893494 100644
--- a/src/jcgp/GUI.java
+++ b/src/jcgp/GUI.java
@@ -1,43 +1,66 @@
package jcgp;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+
import javafx.application.Application;
-import javafx.event.EventHandler;
-import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TabPane.TabClosingPolicy;
-import javafx.scene.input.MouseDragEvent;
-import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import jcgp.JCGP.Resources;
-import jcgp.gui.Console;
+import jcgp.gui.GUIConsole;
import jcgp.gui.SettingsPane;
import jcgp.gui.population.ChromosomePane;
-import jcgp.gui.population.GUIGene;
public class GUI extends Application {
+ /* Colours */
+ /** NEUTRAL_COLOUR is the colour elements should be when no interaction is occurring
+ * (no hovering, clicking, dragging or any other form of interaction). */
public static final String NEUTRAL_COLOUR = "#FFFFFF";
public static final String HARD_HIGHLIGHT_COLOUR = "#5496FF";
- public static final String MEDIUM_HIGHLIGHT_COLOUR = "#89AAD6";
+ // 89AAD6
+ public static final String MEDIUM_HIGHLIGHT_COLOUR = "#75BAFF";
public static final String SOFT_HIGHLIGHT_COLOUR = "#C7DFFF";
- public static final String GOOD_SELECTION_COLOUR = "#BDFFC2";
- public static final String NEUTRAL_SELECTION_COLOUR = "#FBFFB8";
- public static final String BAD_SELECTION_COLOUR = "#FF9C9C";
+ // BDFFC2
+ public static final String GOOD_SELECTION_COLOUR = "#38C25B";
+ // FBFFB8
+ public static final String NEUTRAL_SELECTION_COLOUR = "#EDEB72";
+ // FF9C9C
+ public static final String BAD_SELECTION_COLOUR = "#F53D3D";
+
+ /* Sizes and distances */
+
+ public static final double RESIZE_MARGIN = 5.0;
+
+ public static final double SETTINGS_WIDTH = 190;
+ public static final double CONSOLE_HEIGHT = 100;
+
+ public static final double WRAP_WIDTH = 90;
+
private static JCGP cgp;
public static Resources resources;
-
+ private BorderPane leftPane;
private BorderPane window;
private ChromosomePane[] chromosomes;
private TabPane mainPane;
- private static Console console;
+ private static GUIConsole console = new GUIConsole();
private SettingsPane settings;
+
+ public static final PrintStream out = new PrintStream(new OutputStream() {
+ @Override
+ public void write(int b) throws IOException {
+ console.getTextArea().appendText(String.valueOf((char) b));
+ }
+ });
public static void main(String[] args) {
@@ -45,7 +68,6 @@ public class GUI extends Application {
resources = cgp.getResources();
launch();
-
}
@Override
@@ -70,41 +92,24 @@ public class GUI extends Application {
settings = new SettingsPane(cgp);
- mainPane.setPrefHeight(500);
+ //mainPane.setPrefHeight(500);
+
+ leftPane = new BorderPane();
+ leftPane.setCenter(mainPane);
+ leftPane.setBottom(console);
window = new BorderPane();
- window.setCenter(mainPane);
- window.setRight(settings);
- primaryStage.addEventFilter(MouseDragEvent.MOUSE_DRAG_RELEASED, new EventHandler<MouseDragEvent>() {
- @Override
- public void handle(MouseDragEvent event) {
- // preemptively determine whether this event will reach a GUIGene
- // sodding Controls...
- if (event.getTarget() instanceof Node) {
- Node source = ((Node) event.getTarget());
- while (source != null) {
- if (source instanceof GUIGene) {
- return;
- }
- source = source.getParent();
- }
- }
- event.consume();
- ((GUIGene) event.getGestureSource()).resetState();
- ((GUIGene) event.getGestureSource()).updateLines();
+ window.setCenter(leftPane);
+ window.setRight(settings);
- }
- });
+ //primaryStage.setMinHeight(600);
+ //primaryStage.setMinWidth(800);
-
- primaryStage.setMinHeight(600);
- primaryStage.setMinWidth(800);
+ primaryStage.setTitle("JCGP");
primaryStage.setScene(new Scene(window));
primaryStage.show();
-
-
}
}