JavaFx Progress cannot be to solve a variable

I'm trying to put the progress to 100% after meet condition OK. But it not finds the variable "progressBar", if instead of set the progress, I set the visibility, works.

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);
    }
});

Tank's


ANSWERS:


I think your issue is that you cannot set a unidirectionally bound value.

Unbind the value before you try to set it.

For example:

if (newValue.equals(ConstantesEtapa.ETAPA_OK)) {
    progressBar.progressProperty().unbind();
    progressBar.setProgress(1.0);
}


 MORE:


 ? MVC with javaFX
 ? How to show a progress bar while downloading in javafx
 ? JavaFX Change text under Progress Indicator (default: Done)
 ? JavaFX Change text under Progress Indicator (default: Done)
 ? JavaFX Change text under Progress Indicator (default: Done)
 ? Change JavaFX progress bar style
 ? Set default skin in JavaFX with ComboBox
 ? Remove rectangle from Progress Indicator
 ? Add progress bar in JavaFX table pagination
 ? JavaFX progress bar show file upload status