JavaFX ProgressBar resize graphic (Possible bug in JavaFX8)

558 views Asked by At

I uploaded the problem on picload (Dont have enough repuations for hosting pictures :/ ) http://picload.org/view/capioac/progressbarbug.png.html

In my JavaFX8 program I'm using progressbars with an indicator, animating from left to right. The progressbar has the default -1 value set as progress for showing this behaviour.

If the program is resized the progressbars also change their size accordingly to the window width.

The problem is that the bar inside the progressbar won't addapt to the new size. It's moving and showing as before the resize and even leaving it's bounds.

If i reload my program page with the progressbars, the bar animations are again displayed right, but when I rezise, it happens again that the bar is showing this weird behaviour.

I tried removing the css styles and running the progressbar on different Threads.

Has anyone encountered the same problem, or even has got a solution? Can anyone reproduce this situation?

1

There are 1 answers

1
brian On BEST ANSWER

Bug for sure. File it.

Temp fix.

    @Override
    public void start(Stage stage) {
        ProgressBar pb = new ProgressBar(-1);
        stage.setScene(new Scene(new VBox(pb), 300, 250));
        stage.show();
        //screwed up on first showing from this bind
        pb.prefWidthProperty().bind(stage.widthProperty().divide(2));
        //gets fixed when resized
        pb.prefWidthProperty().addListener((obs,ov,nv)->{
            pb.setProgress(0);
            pb.setProgress(-1);
        });
    }