New JavaFX documentation: Concurrency, SWT

The JavaFX documentation team has taken advantage of the JavaFX 2.0.3 update release to publish two new documents:

  • Concurrency in JavaFX
    This article describes the capabilities provided by the javafx.concurrent package to create multithreaded applications. You learn how to keep your JavaFX application user interface (UI) responsive by delegating time-consuming task execution to background threads.

  • JavaFX Interoperability with SWT
    This article shows how to add a JavaFX scene graph to a Standard Widget Toolkit (SWT) application, and how to make SWT and JavaFX controls interoperate.

  • A few other documents have been updated as follows:

And if you are new to JavaFX 2, you should definitely have a look at the full JavaFX documentation.

 Enjoy!



Comments:

Hi,

Can you tell me if the TimerTask and Timer objects are no use in JavaFX. I had used these in an application pre-latest release 2.0.3, and the application worked, now I'm getting an exception "not JavaFX thread".

Do I need to wrap these in a Task?. I feel it is not clear in the document. Perhaps you could provide a couple more examples to improve the document

Posted by guest on February 29, 2012 at 02:31 AM PST #

You can continue using TimerTask and Timer objects in your code. The exception "not JavaFX thread" is thrown when you try to modify JavaFX UI from these tasks, which must happen on the JavaFX Application thread only. Wrap your code into a Runnable object and pass to the Platform.runLater method.

As for your code which "worked" before release 2.0.3, I can only suggest that some FX methods did not have checks for the correct thread usage. By this reason, you did not get exceptions. However, using incorrect thread, you may encounter asynchronous issues such as data loss and deadlocks.
For any questions or comments on JavaFX documentation, please use the feedback link at the document pages.

Posted by ifedor on March 29, 2012 at 09:15 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This blog is maintained by Nicolas Lorain, Java Client Product Manager. The views expressed on this blog are my own & do not necessarily reflect the views of Oracle.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today