在满足条件 OK 后,我试图将进度提高到 100%。但它没有找到变量“progressBar”,如果我没有设置进度,而是设置了可见性,就可以了。
columSituacao.setCellValueFactory(new Callback<CellDataFeatures<Tabela, HBox>, ObservableValue<HBox>>() {
public ObservableValue<HBox> call(CellDataFeatures<Tabela, HBox> p) {
final Tabela tabela = p.getValue();
final ProgressBar progressBar = new ProgressBar(0.0);
progressBar.setPrefWidth(columSituacao.getWidth());
progressBar.progressProperty().bind(tabela.progressProperty());
final HBox box = new HBox();
box.setPrefHeight(Progress.PREF_HEIGHT);
final Text text = new Text();
text.textProperty().bind(tabela.etapaProperty());
final BorderPane border = new BorderPane();
border.setTop(text);
border.setBottom(progressBar);
BorderPane.setAlignment(text, Pos.CENTER);
tabela.etapaProperty().addListener(new ChangeListener<String>() {
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue.equals(ConstantesEtapa.ETAPA_OK)) {
progressBar.setProgress(1.0);//Here is the exception
}
}
});
box.getChildren().add(border);
return new SimpleObjectProperty<HBox>(box);
}
});
坦克的