util
Clone or download
Modified Files
--- 'a/.idea/jarRepositories.xml'
+++ b/.idea/jarRepositories.xml
@@ -16,5 +16,10 @@
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
+ <remote-repository>
+ <option name="id" value="central" />
+ <option name="name" value="bintray" />
+ <option name="url" value="https://jcenter.bintray.com" />
+ </remote-repository>
</component>
</project>
\ No newline at end of file
--- 'a/pom.xml'
+++ b/pom.xml
@@ -52,6 +52,9 @@
<IkonliVersion>11.5.0</IkonliVersion>
<IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
+
+ <JavaFXVersion>16-ea+4</JavaFXVersion>
+
</properties>
<dependencies>
@@ -84,6 +87,19 @@
<version>${IkonliFA5PackVersion}</version>
</dependency>
+ <dependency>
+ <groupId>org.openjfx</groupId>
+ <artifactId>javafx-controls</artifactId>
+ <version>${JavaFXVersion}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.openjfx</groupId>
+ <artifactId>javafx-base</artifactId>
+ <version>${JavaFXVersion}</version>
+ </dependency>
+
<dependency>
--- /dev/null
+++ b/src/main/java/com/StreamPi/Util/FormHelper/HBoxInputBox.java
@@ -0,0 +1,43 @@
+package com.StreamPi.Util.FormHelper;
+
+import javafx.geometry.Insets;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.Region;
+
+public class HBoxInputBox extends HBox {
+ private TextField textField;
+ public HBoxInputBox(String labelText, TextField textField, CheckBox enablerCheckBox)
+ {
+ textField.setPrefWidth(100);
+
+ Label label = new Label(labelText);
+
+
+
+ getChildren().addAll(label, new SpaceFiller(SpaceFiller.FillerType.HBox), textField);
+ setSpacing(5.0);
+
+ if(enablerCheckBox != null)
+ {
+ textField.disableProperty().bind(enablerCheckBox.selectedProperty());
+ HBox.setMargin(enablerCheckBox, new Insets(0, 0, 0, 45));
+ getChildren().add(enablerCheckBox);
+ }
+
+ this.textField = textField;
+ }
+
+ public HBoxInputBox(String labelText, TextField textField)
+ {
+ this(labelText, textField, null);
+ }
+
+ public TextField getTextField()
+ {
+ return textField;
+ }
+}
--- /dev/null
+++ b/src/main/java/com/StreamPi/Util/FormHelper/HBoxInputBoxWithFileChooser.java
@@ -0,0 +1,64 @@
+package com.StreamPi.Util.FormHelper;
+
+import javafx.geometry.Insets;
+import javafx.scene.control.Button;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.Region;
+import javafx.stage.FileChooser;
+import javafx.stage.Window;
+import org.kordamp.ikonli.javafx.FontIcon;
+
+import java.io.File;
+
+public class HBoxInputBoxWithFileChooser extends HBox {
+ public HBoxInputBoxWithFileChooser(String labelText, TextField textField, CheckBox enablerCheckBox, FileChooser.ExtensionFilter extensionFilter)
+ {
+ HBoxInputBox hBoxInputBox = new HBoxInputBox(labelText, textField);
+
+ setHgrow(hBoxInputBox, Priority.ALWAYS);
+ getChildren().addAll(hBoxInputBox);
+ setSpacing(5.0);
+
+ TextField tf = hBoxInputBox.getTextField();
+ tf.setPrefWidth(300);
+ tf.setDisable(true);
+
+
+ Button button = new Button();
+ FontIcon fontIcon = new FontIcon("far-folder");
+ //fontIcon.setIconColor(Paint.valueOf(iconColorHex));
+ //fontIcon.setIconSize(iconSize);
+ button.setGraphic(fontIcon);
+
+ button.setOnAction(event -> {
+ FileChooser fileChooser = new FileChooser();
+
+ fileChooser.getExtensionFilters().addAll(
+ extensionFilter
+ );
+
+
+ try {
+ File selectedDirectory = fileChooser.showOpenDialog(button.getScene().getWindow());
+ textField.setText(selectedDirectory.getAbsolutePath());
+ }
+ catch (NullPointerException e)
+ {
+ // No folder selected
+ }
+ });
+
+ getChildren().add(button);
+
+ if(enablerCheckBox!=null)
+ {
+ button.disableProperty().bind(enablerCheckBox.selectedProperty());
+ HBox.setMargin(enablerCheckBox, new Insets(0, 0, 0, 45));
+ getChildren().add(enablerCheckBox);
+ }
+ }
+}
--- /dev/null
+++ b/src/main/java/com/StreamPi/Util/FormHelper/SpaceFiller.java
@@ -0,0 +1,26 @@
+package com.StreamPi.Util.FormHelper;
+
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.Region;
+import javafx.scene.layout.VBox;
+
+public class SpaceFiller extends Region {
+
+ public SpaceFiller(FillerType fillerType)
+ {
+ if(fillerType == FillerType.HBox)
+ {
+ HBox.setHgrow(this, Priority.ALWAYS);
+ }
+ else if(fillerType == FillerType.VBox)
+ {
+ VBox.setVgrow(this, Priority.ALWAYS);
+ }
+ }
+
+ public enum FillerType
+ {
+ HBox, VBox
+ }
+}
--- 'a/src/main/java/module-info.java'
+++ b/src/main/java/module-info.java
@@ -4,8 +4,11 @@ module com.StreamPi.Util {
requires org.kordamp.ikonli.javafx;
requires org.kordamp.ikonli.fontawesome5;
+ requires javafx.base;
+ requires javafx.controls;
exports com.StreamPi.Util.Version;
exports com.StreamPi.Util.Exception;
exports com.StreamPi.Util.Platform;
+ exports com.StreamPi.Util.FormHelper;
}
\ No newline at end of file