本文整理了Java中javafx.concurrent.Worker.progressProperty()
方法的一些代码示例,展示了Worker.progressProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Worker.progressProperty()
方法的具体详情如下:
包路径:javafx.concurrent.Worker
类名称:Worker
方法名:progressProperty
暂无
代码示例来源:origin: org.controlsfx/controlsfx
public WorkerProgressPane(ProgressDialog dialog) {
this.dialog = dialog;
this.progressBar = new ProgressBar();
progressBar.setMaxWidth(Double.MAX_VALUE);
getChildren().add(progressBar);
if (worker != null) {
progressBar.progressProperty().bind(worker.progressProperty());
}
}
代码示例来源:origin: net.sf.sf3jswing/kernel-core
public void run() {
browser.webEngine.getLoadWorker().progressProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
if (browser.webEngine.getLoadWorker().getProgress() != -1) {
progressBar.setValue((int) Math.round(browser.webEngine.getLoadWorker().getProgress() * 100.));
}
}
});
browser.webEngine.getLoadWorker().runningProperty().addListener(new ChangeListener<Boolean>() {
public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
progressBar.setVisible(t1);
}
});
}
};
代码示例来源:origin: org.controlsfx/controlsfx
private void begin() {
// Platform.runLater needs to be used to show the dialog because
// the call begin() is going to be occurring when the worker is
// notifying state listeners about changes. If Platform.runLater
// is not used, the call to show() will cause the worker to get
// blocked during notification and it will prevent the worker
// from performing any additional notification for state changes.
//
// Sine the dialog is hidden as a result of a change in worker
// state, calling show() without wrapping it in Platform.runLater
// will cause the progress dialog to run forever when the dialog
// is attached to workers that start out with a state of READY.
//
// This also creates a case where the worker's state can change
// to finished before the dialog is shown, resulting in an
// an attempt to hide the dialog before it is shown. It's
// necessary to track whether or not this occurs, so flags are
// set to indicate if the dialog is visible and if if the call
// to show should still be allowed.
cancelDialogShow = false;
Platform.runLater(() -> {
if(!cancelDialogShow) {
progressBar.progressProperty().bind(worker.progressProperty());
dialogVisible = true;
dialog.show();
}
});
}
内容来源于网络,如有侵权,请联系作者删除!