1-12. Generating a Background Process
Problem
You want to create a GUI application that simulates the copying of files using background processing while displaying the progress to the user.
Solution
Create an application typical of a dialog box showing progress indicators while copying files in the background. The following are the main classes used in this recipe:
javafx.scene.control.ProgressBar
javafx.scene.control.ProgressIndicator
javafx.concurrent.Task
classes
The following source code is an application that simulates a file copy dialog box displaying progress indicators and performing background processes:
package javafx2introbyexample.chapter1.recipe1_12;
import java.util.Random;
import javafx.application.Application; import javafx.beans.value.ChangeListener; ...
Get JavaFX 2.0: Introduction by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.