Eclipse and JavaFX 1.3 Plug-in

  • Phil Freihofner
Posted: Sun, 05/02/2010 - 17:06

I'm very excited to see the plug-in for JavaFX 1.3 for Eclipse. Many thanks for doing this!

I am not having luck getting it to work, though. I should warn you that I am new to JavaFX and have only been working with Java for just under a year and Eclipse for about two months. My JavaFX experience consists of getting two tutorial programs (that were put in via "cut and paste") to run using JavaFX 1.2.1. (This after several hours thrashing around by downloading and trying to get Eclipse to work with 1.3 with a plug-in built for 1.2.1.)

As advised, I went to Eclipse "Help" and "Load new software" and put in the Eclipse address you gave for the new plug-in: (http://download.exadel.org/javafx_plugin/updates/stable/).

When I went to do a new project creation, I was NOT prompted to set the JavaFX SDK. I can confirm that I had the JavaFX Perspective up and the option: File/New/JavaFX Project was selected. Also, that I did a restart for Eclipse after changing values in the Window/Preferences area, as well as after loading the new plug-in.

(Is there a way to confirm the new plug-in is being used?)

The two existing demo programs and the new project all seemed to continue to point to the old JavaFX SDK (1.2.1).

When I changed the ClassPath for Java/BuildPath/ClassPath Variables/JAVAFX_HOME to the JavaFX1.3 location, attempting to run the code gave many errors.

For example, the first message on the console after an attempted run was the following:

C:\Documents and Settings\Phil\workspace\BouncingBall\src\whatever\bounce.fx:66: warning: In animation target balls[ i].translateY, balls[ i] is not a constant, but will be treated as such. You may want to rewrite as:
def temp = balls[ i]
temp.translateY => x

at (0s) { balls[i].translateY => 30 } ,
^

The offending demo code from "JavaFX in Action" follows, but I suspect the issue has more to do with the install than anything in the code! This code works fine with the classpath JAVAFX_HOME pointing to JavaFX 1.2.1's file folder. Unfortunately, I do not know how to preserve the indentations on this cut-and-paste of the example code.

package whatever;
import javafx.animation.*;
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.effect.*;
import javafx.scene.shape.*;
import javafx.scene.input.*;
import javafx.scene.paint.*;

/**
* @author Phil
*/

var balls = for(i in [0..<6]) {
var c = Circle {
translateX: (i*40)+90; translateY: 30;
radius: 18;
fill: RadialGradient {
focusX: 0.25; focusY:0.25;
proportional: true;
stops: [
Stop { offset: 0; color: Color.WHITE; } ,
Stop { offset: 1; color: Color.BLACK; }
]
};
}
}
Stage {
scene: Scene {
content: Group {
content: [
Rectangle {
width: 380; height: 250;
opacity: 0.01;
onMouseClicked:
function(ev:MouseEvent) { FX.exit(); }
} , balls
]
effect: Reflection {
fraction: 0.25; topOffset: -18;
topOpacity: 0.5; bottomOpacity: 0.125;
}
}
fill: LinearGradient {
endX: 0; endY: 1; proportional: true;
stops: [
Stop { offset: 0.74; color: Color.TRANSPARENT; } ,
Stop { offset: 0.75; color: Color.BLACK } ,
Stop { offset: 1; color: Color.GRAY }
]
}
};
style: StageStyle.TRANSPARENT
};

Timeline {
keyFrames: for(i in [0.. 30 } ,
at (1s) { balls[i].translateY => 230
tween Interpolator.EASEIN }
]
}.play();
}
}
}
}.play();

Many thanks for any help you can offer. In the meantime, I am back to JavaFX 1.2.1 which seems to be working despite having installed your plug-in. I'm sure this will hold me for a couple weeks, as the "JavaFX in Action" book is an even earlier version, and I have a lot to learn still.

Phil Freihofner

It seems that you might have

  • maxkatz
  • 02/17/10
  • Sun, 05/02/2010 - 19:24

It seems that you might have two plug-ins in the same Eclipse. What I would recommend is to install our plug-in into a clean Eclipse. It should work without any problems.

will try and report back within a couple days

  • Phil Freihofner
  • 05/02/10
  • Mon, 05/03/2010 - 10:14

Thanks for the advice. I will give this a try and report back within a couple days if it worked or not.

uninstalled earlier plugin; Exadel 1.3 plugin now works

  • Phil Freihofner
  • 05/02/10
  • Mon, 05/03/2010 - 21:53

I found a way to uninstall the JavaFX 1.2.1 version plugin. Thus, I did not have to uninstall and reload Eclipse in its entirety.

The JavaFX 1.3 plugin seems to work just fine. I created two new javaFX projects and cut-and-pasted the two samples of code that I have. The code runs fine in one case, and generates an error (mentioned above) in the other. For now, I am going to assume that this error has to do with changes between earlier versions of JavaFX and JavaFX 1.3, since my first code sample works fine (and the old plugin is gone gone gone).

To uninstall a plugin from within Eclipse: goto Help\About, then click "Installation Details". From the "Installed software" tab, one can select the item to uninstall.

OK, back to learning this cool language (am using "JavaFX in Action").

Again, thanks!

Glad to hear. Let us know if

  • maxkatz
  • 02/17/10
  • Tue, 05/04/2010 - 07:10

Glad to hear. Let us know if have any other questions.