Showing posts with label javaFX. Show all posts
Showing posts with label javaFX. Show all posts

Monday, March 1, 2010

Useful constants in JavaFX

There are a couple of useful constants in JavaFX that for sure I'll use later in the future, check them out:

__DIR__ 
Dir will return the directory of the currently executed FX source file. A sample of how to use it would be something simple like:
 println("The current directory of this FX file is: {__DIR__});  
The value of this constant may be a jar in case you are executing this from a jar.


__FILE__ 
File is similar to the previous one, the main difference is that it will return the url of the current source file.

__PROFILE__
Profile will have only three values, "mobile","desktop" and "browser" depending on how the script was executed.

Codebase
Using the following code you will get the value of the "codebase" attribute located in the .jnlp file from your application. So in case you .jnpl file goes like this:
 codebase="http://example.sun.com/JavaFX/AppletDeploy/dist/"   
Then you can retrieve the value this way:
 var codebase = FX.getProperty("javafx.application.codebase");  

Thursday, January 21, 2010

JavaFX Eclipse plugin error

If you decided to give it a try to JavaFX using Eclipse you may run into your first problem right after installing the JavaFX plugin for Eclipse and it may look like these errors:

Cannot access java.lang.Object class file for java.lang.Object not found
Invalid assignment
Package javafx.scene does not exist
Package javafx.stage does not exist

First of all make sure that you added correctly the JavaFX SDK to your libraries:



If this is correct then take a look at your ".classpath" file and make sure that the JavaFX entry looks like this:

      <classpathentry kind="con" path="com.sun.javafx.eclipse.core.classpath.SDKClasspathContainer"/>  

And not like this:

      <classpathentry kind="con" path="com.sun.javafx.eclipse.core.classpath.SDKClasspathContainer/reserved/desktop"/>  

That fixed it for me ;)

Tuesday, June 2, 2009

JavaFX @JavaOne 2009

Now that the JavaOne opening presentation is over my guess is that most JavaFX developers are thrilled with all the news presented in just a couple of hours and jumped back on their keyboards trying to code the newest coolest application out there, on my side I decided to post a summary of the news that interested me the most:
  • Oracle CEO Larry Ellison giving his support to JavaFX and talking about Oracle's interested in this technology.
  • JavaFX SDK 1.2 available on Linux even though is a beta version it is still good news.
  • An enhanced version of the plugin for Eclipse is available for those that are not so keen to use Netbeans that much. You can read more information about the release on Neil Bartlett's blog entry here.
  • Finnally a reasonable good UI tool is available, take a look at JFXBuilder here, it is still in the early stages but it offers a few cool things.
  • Verizon revealing that will open an application store based on Java ME and also making available APIs for developers to write rich applications.
Well it has been a very good day for Java developers, and let's hope that all (or at least most) of the doubts about the future of JavaFX is clear after these annoucements, I guess the time will tell.

Saturday, March 21, 2009

JavaFX 1.1 on Linux using Netbeans 6.5 or Eclipse 3.4


If you are looking forward to try javaFX and you are a Linux user, probably you already know that the released versions are for Windows and Mac, fortunately there are already some hacks available to make the Mac version work on Linux. Not all the features are available and we'll still have to wait till Sun releases the official version, but in the mean time you can give it a try in Netbeans this way.

If while trying to install the linux sdk .nbm file in Netbeans, you get the following error "Some plugins require capability javafx.sdk.v1_1 No plugin providing the capability javafx.sdk.v1_1 could be found", check the content of the file org-netbeans-modules-javafx-sdk-lin.nbm (using unzip -l), probably the zip process failed and some files are missing.

To use it in Eclipse, first download and install the plugin here using the update site. Then unzip the file org-netbeans-modules-javafx-sdk-lin.nbm used previously for the Netbeans installation. Inside you will find the follwing folder "netbeans/javafx-sdk/", move the folder to your preffered location. Now in Eclipse edit the new classpath variable JAVAFX_HOME in Eclipse at Preferences -> Java -> Build Path -> Classpath Variables by pointing to the javafx-sdk location.

That's it, now you can use javaFX 1.1 in both of your IDEs, as I told you before, is not a complete version but it's a good way to start working on it until the new version is released.