Environment is Java SE (Java 8 Update 40) on Windows 7
tracker = new TrackBackupService();
tracker.setOnReady(WorkerStateEvent)->{
backupUserCancelled=false;
});
tracker.setOnScheduled ((WorkerStateEvent)->{
backupProgressBar.progressProperty().bind(tracker.progressProperty());
backupPathInProcessingLabel.textProperty().bind(tracker.pathInProcessingProperty());
backupWorkDoneLabel.textProperty().bind(tracker.workDoneProperty().asString("%.0f"));
backupTotalWorkLabel.textProperty().bind(tracker.totalWorkProperty().asString("%.0f"));
backupSelectTargetButton.disableProperty().bind(tracker.runningProperty());
backupWarningMessageLabel.visibleProperty().bind(tracker.runningProperty());
backupStartButton.disableProperty().bind(tracker.runningProperty());
backupStopButton.disableProperty().bind(Bindings.not(backupStartButton.disableProperty()));
backupSizeLabel.textProperty().bind(tracker.totalSizeProperty());
backupDirectoryCountLabel.textProperty().bind(tracker.directoryCountProperty().asString());
backupFileCountLabel.textProperty().bind(tracker.fileCountProperty().asString());
backupResultLabel.textProperty().bind(tracker.messageProperty());
});
This is the code for the class of service.
updateProgress(_doneCount,_totalCount);
updateMessage("Success:" +_succeededCount+"/" +"Fail:" +_failedCount);
Platform.runLater() - > {
succeededCount.set(_succeededCount);
succeededFileCount.set(_succeededFileCount);
succeededDirectoryCount.set(_succeededDirectoryCount);
failedCount.set(_failedCount);
failedFileCount.set(_failedFileCount);
failedDirectoryCount.set(_failedDirectoryCount);
totalSize.set(_totalSize);
directoryCount.set(_directoryCount);
fileCount.set(_fileCount);
pathInProcessing.set(_pathInProcessing);
});
Sometimes when you try to update the progress bar with these codes, it does not draw.
However, if you minimize and maximize the window, the drawing is done.
Is there a way to force a re-draw a progress bar?
This is an animation when the symptom occurs.
Also, I changed the UI style in CSS.
java javafx
There seems to be no problem with the code.There are times when problems occur and times when problems do not occur, so there is a high possibility that JavaFX itself is a problem.Or maybe it's a running environment issue.
I think you should check if changing the machine or JDK version will reproduce the problem.
As far as OpenJDK bug trackers are concerned, the likely issue has been fixed in the first release of JDK 8.
https://bugs.openjdk.java.net/browse/JDK-8124671
There was a similar problem below, but this is a problem when I changed Skin dynamically, so it seems a little different from this case.It's a style issue, so if you remove the style set in ProgressBar, the situation may change.
https://bugs.openjdk.java.net/browse/JDK-8087746
Is there a way to force a re-draw a progress bar?
There is no public method to force redrawing.Protected methods include setNeedsLayout() forcing the child Node to re-evaluate its layout.
578 Understanding How to Configure Google API Key
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.