fix(ui): validate background image url. Mentioned in #1116.

This commit is contained in:
huanghongxun
2021-10-20 15:49:16 +08:00
parent 74a20bf11d
commit 57554c8d4b
2 changed files with 6 additions and 0 deletions

View File

@@ -226,6 +226,11 @@ public class MultiFileItem<T> extends VBox {
BorderPane.setAlignment(customField, Pos.CENTER_RIGHT);
customField.disableProperty().bind(left.selectedProperty().not());
if (!customField.getValidators().isEmpty()) {
FXUtils.setValidateWhileTextChanged(customField, true);
}
pane.setRight(customField);
return pane;

View File

@@ -107,6 +107,7 @@ public class PersonalizationPage extends StackPane {
.setChooserTitle(i18n("launcher.background.choose"))
.bindBidirectional(config().backgroundImageProperty()),
new MultiFileItem.StringOption<>(i18n("launcher.background.network"), EnumBackgroundImage.NETWORK)
.setValidators(new URLValidator(true))
.bindBidirectional(config().backgroundImageUrlProperty())
));
backgroundItem.selectedDataProperty().bindBidirectional(config().backgroundImageTypeProperty());