This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes JavaFX Code On Jim's Blog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JavaFX Code On Jim Watch "JavaFX Code On Jim New topic
Author

JavaFX Code On Jim's Blog

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Jim, I've been trying to run some of the code on your blog but have at times ran into interesting issues. One small example is this code. I get errors regarding the var firstName:String and basically any 2nd var declaration.

Another example is the following code:

var firstNameRow = Row { alignment: Alignment.BASELINE }

JavaFX complains that Alignment only allows id and name attributes. But changing it to:

var firstNameRow = Row { alignment: BASELINE }

works just fine. In fact, all the code examples from the openjfx site as well as the JavaFX Planet site work just fine. What I am wondering is if you have been using a more cutting edge version of JavaFX and if so what is the best way to go about getting that and it being able to work with existing tools? It is very confusing right now.


GenRocket - Experts at Building Test Data
James Weaver
author
Ranch Hand

Joined: Oct 11, 2007
Posts: 40
There are two versions of JavaFX: The interpreted version served as a prototype. That is most likely the version that you are using. The "real" version of JavaFX Script is the compiled version, which compiles to JVM bytecode. You can compile and execute compiled JavaFX Script programs from the command line, or using the NetBeans 6.1 (currently beta) IDE with the JavaFX Plugin. Please see the Creating Rich Internet Applications With Compiled JavaFX Script Technology tutorial (first in a series that I'm writing for java.sun.com) to learn how to obtain the JavaFX Script compiler and begin developing compiled JavaFX Script apps. By the way, the "Compiled JavaFX Script" category of my weblog contains compiled (as opposed to interpreted) JavaFX Script examples.


Thanks,<br />James L. (Jim) Weaver<br /><a href="http://JavaFXpert.com" target="_blank" rel="nofollow">"Helping you become a JavaFXpert" weblog</a>
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Why would one syntax work in one and not the other? This seems bad to me. I'll go read that link, maybe I am just missing something. But take Groovy for example. Interpreted or compiled, it is the same script.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I just came back to ask something else about this and re-read your response:

The interpreted version served as a prototype. That is most likely the version that you are using. The "real" version of JavaFX Script is the compiled version, which compiles to JVM bytecode


I still think it is confusing that this was done but I think I understand now. The only problem is how do you know for sure the code you are looking at that is scattered around the web is for the compiled version or the "prototype" version? I can imagine this being very frustrating.
James Weaver
author
Ranch Hand

Joined: Oct 11, 2007
Posts: 40
That's a valid concern. If the JavaFX Script program has the "operation" keyword, it's interpreted, because the compiled version combined "function" and "operation". Also, static variables used as constants are a give-away (e.g. Color.RED). The Rosetta Stone post contains some other differences. It also contains a link to a nice PlanetJFX article on the subject.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Wonderful. Thanks Jim.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaFX Code On Jim's Blog
 
Similar Threads
Mobile JavaFX and Flash Lite
Insider's Guide to Mixing Swing and JavaFX
Inheritance question
JavaFX / Swing/ JSF
Add a Table Row