O'Reilly logo

JavaFX 2.0: Introduction by Example by Carl Dea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required