From d0718fe4762f6a50ec851085cb5d0e6d39ccc1b0 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Sat, 15 Nov 2014 23:30:20 +0000 Subject: Added GUIConnection and GUIMutable, started reintroducing lines but positioning is not working correctly. --- src/jcgp/gui/population/GUIOutput.java | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/jcgp/gui/population/GUIOutput.java') diff --git a/src/jcgp/gui/population/GUIOutput.java b/src/jcgp/gui/population/GUIOutput.java index ccc96c3..8ae9485 100644 --- a/src/jcgp/gui/population/GUIOutput.java +++ b/src/jcgp/gui/population/GUIOutput.java @@ -1,17 +1,29 @@ package jcgp.gui.population; +import javafx.scene.control.Label; import javafx.scene.paint.Paint; +import javafx.scene.shape.Circle; import jcgp.backend.population.Output; import jcgp.gui.constants.Constants; -public class GUIOutput extends GUIGene { +public abstract class GUIOutput extends GUIGene implements GUIMutable { private Output output; public GUIOutput(final Output output) { super(); - this.output = output; + + Circle socket = new Circle(-Constants.NODE_RADIUS, 0, Constants.SOCKET_RADIUS, Paint.valueOf("white")); + socket.setId(String.valueOf(0)); + socket.setStroke(Paint.valueOf("black")); + + Label connectionLabel = new Label("S"); + connectionLabel.setStyle("-fx-background-color:rgb(255, 255, 255); -fx-border-color:rgba(0, 0, 0, 0.5);"); + connectionLabel.relocate(socket.getCenterX() + 5, socket.getCenterY() - 10); + connectionLabel.setVisible(false); + + getChildren().addAll(socket, connectionLabel); } void setOutput(Output output2) { @@ -21,11 +33,14 @@ public class GUIOutput extends GUIGene { @Override public void mouseEnter() { - mainCircle.setFill(Paint.valueOf(Constants.SOFT_HIGHLIGHT_COLOUR)); + setState(GUIGeneState.HOVER); + getGUIConnection(output.getSource()).activeHover(true); } @Override public void mouseExit() { - mainCircle.setFill(Paint.valueOf(Constants.NEUTRAL_COLOUR)); + setState(GUIGeneState.NEUTRAL); + getGUIConnection(output.getSource()).activeHover(false); } + } -- cgit v1.2.3