Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Figure 2 . 0 TaskProgress graphical user interface Long running tasks should not be run on the javafx application thread as they render the user

Figure 2.0 TaskProgress graphical user interface
Long running tasks should not be run on the javafx application thread as they render the user
interface unresponsive for the duration of the task. For this reason, long running tasks are run in a
background thread. The long running task for this application is a contrived task consisting of a
loop with 10 million iterations.
(a) Create a graphical user interface similar to the one shown in the picture (Figure 2.0). The
progress bar's initial position should be zero. Add the import for concurrency support of a
one-time task.
(10 marks)
(b) On clicking the 'Start Task' button, the progress bar should give a running indication of
progress. Override Task's call() method to implement the task whose progress is to be
displayed. Bind the progress of the progress bar to the progress of the task. A for() loop with
10 million iterations will be a suitable amount of work for the task. With this number of
iterations there is no need to sleep the background thread. During the loop, remember to
check for cancellation as well as updating the progress indication.
(20 marks)
(c) On clicking the 'Cancel Task' button, the task should be cancelled. The progress bar should
then show progress of zero.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions