diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java index 4d43f7c20..41665da88 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java @@ -31,7 +31,6 @@ import javafx.beans.value.*; import javafx.event.Event; import javafx.event.EventDispatcher; import javafx.event.EventType; -import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Cursor; import javafx.scene.Node; @@ -255,20 +254,6 @@ public final class FXUtils { }); } - public static void setupCellValueFactory(JFXTreeTableColumn column, Function> mapper) { - column.setCellValueFactory(param -> { - if (column.validateValue(param)) - return mapper.apply(param.getValue().getValue()); - else - return column.getComputedValue(param); - }); - } - - public static Node wrapMargin(Node node, Insets insets) { - StackPane.setMargin(node, insets); - return new StackPane(node); - } - public static void setValidateWhileTextChanged(Node field, boolean validate) { if (field instanceof JFXTextField) { if (validate) { @@ -622,22 +607,6 @@ public final class FXUtils { } } - public static void bindBoolean(JFXToggleButton toggleButton, Property property) { - toggleButton.selectedProperty().bindBidirectional(property); - } - - public static void unbindBoolean(JFXToggleButton toggleButton, Property property) { - toggleButton.selectedProperty().unbindBidirectional(property); - } - - public static void bindBoolean(JFXCheckBox checkBox, Property property) { - checkBox.selectedProperty().bindBidirectional(property); - } - - public static void unbindBoolean(JFXCheckBox checkBox, Property property) { - checkBox.selectedProperty().unbindBidirectional(property); - } - private static final class EnumBidirectionalBinding> implements InvalidationListener, WeakListener { private final WeakReference> comboBoxRef; private final WeakReference> propertyRef; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionSettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionSettingsPage.java index f1ff1402c..62dfe743f 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionSettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/VersionSettingsPage.java @@ -551,8 +551,8 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag javaCustomOption.valueProperty().unbindBidirectional(lastVersionSetting.javaDirProperty()); gameDirCustomOption.valueProperty().unbindBidirectional(lastVersionSetting.gameDirProperty()); FXUtils.unbind(txtServerIP, lastVersionSetting.serverIpProperty()); - FXUtils.unbindBoolean(chkAutoAllocate, lastVersionSetting.autoMemoryProperty()); - FXUtils.unbindBoolean(chkFullscreen, lastVersionSetting.fullscreenProperty()); + chkAutoAllocate.selectedProperty().unbindBidirectional(lastVersionSetting.autoMemoryProperty()); + chkFullscreen.selectedProperty().unbindBidirectional(lastVersionSetting.fullscreenProperty()); showLogsPane.selectedProperty().unbindBidirectional(lastVersionSetting.showLogsProperty()); FXUtils.unbindEnum(cboLauncherVisibility, lastVersionSetting.launcherVisibilityProperty()); FXUtils.unbindEnum(cboProcessPriority, lastVersionSetting.processPriorityProperty()); @@ -586,8 +586,8 @@ public final class VersionSettingsPage extends StackPane implements DecoratorPag javaCustomOption.bindBidirectional(versionSetting.javaDirProperty()); gameDirCustomOption.bindBidirectional(versionSetting.gameDirProperty()); FXUtils.bindString(txtServerIP, versionSetting.serverIpProperty()); - FXUtils.bindBoolean(chkAutoAllocate, versionSetting.autoMemoryProperty()); - FXUtils.bindBoolean(chkFullscreen, versionSetting.fullscreenProperty()); + chkAutoAllocate.selectedProperty().bindBidirectional(versionSetting.autoMemoryProperty()); + chkFullscreen.selectedProperty().bindBidirectional(versionSetting.fullscreenProperty()); showLogsPane.selectedProperty().bindBidirectional(versionSetting.showLogsProperty()); FXUtils.bindEnum(cboLauncherVisibility, versionSetting.launcherVisibilityProperty()); FXUtils.bindEnum(cboProcessPriority, versionSetting.processPriorityProperty());