« Animating with Dynamic Timeline Values in JavaFX ...and a Scientific Fish Story from 1901 | Main | Leveraging JFXtras and Freebase with JavaFX to Create BandmatesFX »

June 24, 2009

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54f133d6988340115704e2bde970c

Listed below are links to weblogs that reference Asynchronicity in JavaFX 1.2:

Comments

Bruce

The example doesn't work at all. I'm using eclipse and everythere are erros!

Nihar

Hi Jim,

I have read your artical which is pretty much informative.

with a reference of your example i have create one sample application which asynchronously call the webservices.

instread of ticker class ( in your example) i have implement RunnableFuture interface to a class [Control.java] which is responsible for making SOAP based webservices calls.
and i have override the run method in which i am making webservice request and getting back the response in a TickerHandler.

so my main.fx calls taskController.start() to start the thread.

But unfortunately when i click on a button to call webservices it hangs for a which then a response is return.

so eventually i am failed to create asynchronous web service request..

so please do help me how i would achieve this so that my other javafx component wont hang....

Nihar (ntimesc@gmail.com)

Nihar

Hi Jim ,
I have read your article regarding Asynchronicty in JavaFX. it is really a helpful and informative article.

As of now i am working on a application which extensively making webservices calls to perform ongoing computation i have chose javafx as a user interface platform. after reading your article i have tried to create new thread as and when a new webservice request is made.

i have implemented RunnableFuture in the class which is making webservices request.

so does this approach work fine for ongoing computational webservices with javafx ui ?


VictorCharlie

I copied and pasted the example code shown into a NetBeans Project, FX 1.2 (Linux). It won't compile. And the block seems to happen at the mixin Inheritance feature, which I suspect, is related to the interface. TaskController insists that only one non-mixin FX class can be extended. FX doesn't like the interface at all. The parsing keeps insisting we left out a semicolon on the interface.

Forgive me for asking this here. But I did buy the first Apress FX book, got excited, then Java dumps Linux. Now Linux is back on board with 1.2 and I'm trying to learn JavaFX vers. 1.2. Each FX version had profound vocubulary changes that requires re-engineering the examples I do find on the web.

Saurabh

Nice.
JavaFX is catching up demand it seems.
I liked this review about javafx posted on TaranFX http://www.taranfx.com/blog/?p=1173

JavaFX is powerful! I never knew abt this!

Jim Weaver

JavaFX 1.2 has mixin inheritance. Quoting Weiqi Gao from excerpts of chapter 4 of our Pro JavaFX book:

"Understanding Mixin Classes

JavaFX Script supports a form of inheritance called mixin inheritance. A JavaFX Script class can optionally extend one JavaFX Script class and any number of JavaFX Script mixin classes...

A mixin class is a class whose primary purpose is to be extended by other classes and cannot be instantiated directly. Such a class is defined by using the mixin modifier before the class keyword. Like regular classes, mixin classes may contain instance variable and constant declarations, instance function definitions, init blocks, and postinit blocks. Here is an example:

mixin class Locatable {
var x: Number;
var y: Number;
function moveToOrigin() {
x = 0.0;
y = 0.0;
}
function setLocation(x: Number, y: Number) {
this.x = x;
this.y = y;
}
}

The mixin class Locatable will cause classes that extend it to have instance variables x and y and instance functions moveToOrigin()and setLocation().

Extending Classes

You extend JavaFX Script classes by including a super class and mixin list in a class definition. The super class and mixin list appear after the class name and consist of the extends keyword followed by a comma-separated list of class names. The list may contain an optional regular (non-mixin) class and any number of mixin classes. The regular class in the super class and mixin list is called a super class of the class. The mixin classes in the super class and mixin list are called parent mixins of the class. A class is called a subclass of its super class and a mixee of its parent mixins.

A class inherits its super class’s instance variables, instance constants, and instance functions to which the writer of the super class has allowed access. The smallest unit of access rights in JavaFX Script is the JavaFX Script source file. Therefore, if a subclass is in the same file as the super class, it inherits all of its instance variables and instance functions.

A mixee will inherit its parent mixin’s instance variables, instance constants, and instance functions to which the writer of the parent mixin has allowed access."

In this blog post example, the TaskController JavaFX class is extending one JavaFX class and one Java interface.

Hope that helps, John!
Jim Weaver

John O'Conner

Hi Jim,

The example you show above is surprising to me because of the multiple inheritance. I thought that multiple inheritance had been removed from JavaFX SDK 1.2?

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

About/Contact


  • About this blog, and
    how to contact me

VNI Media is a JavaFX Solution Provider


  • As a JavaFX Preferred Solution Provider, we'd be honored to help you with your JavaFX/Java development needs.

JavaFXpert RIA Exemplar Challenge - Win 2000 USD!


  • Create an application in JavaFX that exemplifies the appearance and behavior of a next-generation enterprise RIA (rich internet application).
    Are you up to the challenge?

Upcoming Speaking Engagements:

Pro JavaFX 1.2 Book


  • Written by Jim Weaver, Weiqi Gao, Stephen Chin, and Dean Iverson as a definitive guide to JavaFX and for temporary relief from insomnia. ;-)

Stay up to speed

Upcoming JavaFX Training:

Enter your email address:

Delivered by FeedBurner

Twitter Updates

    follow me on Twitter

    Affiliations:

    December 2009

    Sun Mon Tue Wed Thu Fri Sat
        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 31    

    Disclaimer:

    • Java, the coffee cup logo, and all Java based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. or other countries.
    • By reading this site, you are agreeing that under no circumstances will Veriana Networks, Inc. or its affiliates be responsible for (1) any information contained on or omitted from the site, (2) any person's reliance on any such information, whether or not the information is correct, current or complete, (3) the consequences of any action you or any other person takes or fails to take, whether or not based on information provided by or as a result of the use of the sites.