mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2026-10-29 15:10:30 +08:00
对下载线程数输入框添加校验 (#6266)
This commit is contained in:
@@ -161,7 +161,10 @@ public class DownloadSettingsPage extends StackPane {
|
||||
|
||||
JFXTextField threadsField = new JFXTextField();
|
||||
FXUtils.setLimitWidth(threadsField, 60);
|
||||
FXUtils.bindInt(threadsField, settings().downloadThreadsProperty());
|
||||
FXUtils.bind(threadsField, settings().downloadThreadsProperty(), SafeStringConverter.fromInteger()
|
||||
.restrict(it -> it > 0)
|
||||
.fallbackTo(FetchTask.DEFAULT_CONCURRENCY)
|
||||
.asPredicate(Validator.addTo(threadsField)));
|
||||
|
||||
AtomicBoolean changedByTextField = new AtomicBoolean(false);
|
||||
FXUtils.onChangeAndOperate(settings().downloadThreadsProperty(), value -> {
|
||||
|
||||
Reference in New Issue
Block a user