diff options
Diffstat (limited to 'src/jcgp/gui/settings')
-rw-r--r-- | src/jcgp/gui/settings/GUIBooleanParameter.java | 24 | ||||
-rw-r--r-- | src/jcgp/gui/settings/GUIDoubleParameter.java | 33 | ||||
-rw-r--r-- | src/jcgp/gui/settings/GUIIntegerParameter.java | 18 | ||||
-rw-r--r-- | src/jcgp/gui/settings/GUIParameter.java | 5 |
4 files changed, 73 insertions, 7 deletions
diff --git a/src/jcgp/gui/settings/GUIBooleanParameter.java b/src/jcgp/gui/settings/GUIBooleanParameter.java new file mode 100644 index 0000000..7b20c3b --- /dev/null +++ b/src/jcgp/gui/settings/GUIBooleanParameter.java @@ -0,0 +1,24 @@ +package jcgp.gui.settings; + +import javafx.geometry.Pos; +import javafx.scene.control.CheckBox; +import jcgp.parameters.BooleanParameter; + +public class GUIBooleanParameter extends GUIParameter { + + public GUIBooleanParameter(BooleanParameter parameter) { + setAlignment(Pos.CENTER_LEFT); + setSpacing(5); + + this.parameter = parameter; + + value = new CheckBox(parameter.getName()); + ((CheckBox) value).setSelected(parameter.getValue()); + + value.setDisable(parameter.isManaged()); + + getChildren().add(value); + + } + +} diff --git a/src/jcgp/gui/settings/GUIDoubleParameter.java b/src/jcgp/gui/settings/GUIDoubleParameter.java new file mode 100644 index 0000000..d61899b --- /dev/null +++ b/src/jcgp/gui/settings/GUIDoubleParameter.java @@ -0,0 +1,33 @@ +package jcgp.gui.settings; + +import javafx.geometry.Pos; +import javafx.scene.control.TextField; +import javafx.scene.layout.Priority; +import javafx.scene.text.Text; +import jcgp.GUI; +import jcgp.parameters.DoubleParameter; + +public class GUIDoubleParameter extends GUIParameter { + + public GUIDoubleParameter(DoubleParameter parameter) { + setAlignment(Pos.CENTER_LEFT); + setSpacing(5); + + this.parameter = parameter; + + name = new Text(parameter.getName()); + value = new TextField(String.valueOf(parameter.getValue())); + + ((TextField) value).setAlignment(Pos.CENTER_RIGHT); + + setHgrow(value, Priority.ALWAYS); + + name.setWrappingWidth(GUI.WRAP_WIDTH); + + value.setDisable(parameter.isManaged()); + + getChildren().addAll(name, value); + + } + +} diff --git a/src/jcgp/gui/settings/GUIIntegerParameter.java b/src/jcgp/gui/settings/GUIIntegerParameter.java index 2bf5480..b7a23a4 100644 --- a/src/jcgp/gui/settings/GUIIntegerParameter.java +++ b/src/jcgp/gui/settings/GUIIntegerParameter.java @@ -1,23 +1,31 @@ package jcgp.gui.settings; +import javafx.geometry.Pos; import javafx.scene.control.TextField; +import javafx.scene.layout.Priority; import javafx.scene.text.Text; +import jcgp.GUI; import jcgp.parameters.IntegerParameter; public class GUIIntegerParameter extends GUIParameter { - private TextField value; - public GUIIntegerParameter(IntegerParameter parameter) { + setAlignment(Pos.CENTER_LEFT); + setSpacing(5); + this.parameter = parameter; name = new Text(parameter.getName()); - value = new TextField(String.valueOf((int) parameter.getValue())); + value = new TextField(String.valueOf(parameter.getValue())); + + ((TextField) value).setAlignment(Pos.CENTER_RIGHT); + + setHgrow(value, Priority.ALWAYS); + + name.setWrappingWidth(GUI.WRAP_WIDTH); value.setDisable(parameter.isManaged()); getChildren().addAll(name, value); - } - } diff --git a/src/jcgp/gui/settings/GUIParameter.java b/src/jcgp/gui/settings/GUIParameter.java index d084060..0547758 100644 --- a/src/jcgp/gui/settings/GUIParameter.java +++ b/src/jcgp/gui/settings/GUIParameter.java @@ -1,13 +1,14 @@ package jcgp.gui.settings; +import javafx.scene.control.Control; import javafx.scene.layout.HBox; import javafx.scene.text.Text; import jcgp.parameters.Parameter; public abstract class GUIParameter extends HBox { - + protected Parameter parameter; - protected Text name; + protected Control value; } |