Skip to main content

Problems with animation

4 replies [Last post]
bigalvarado
Offline
Joined: 2008-07-29

Hello to everybody.
I'm using Netbeans 6 with the javaFx plugin and it doesn't find the javafx.animation package (the one with TimeLine and KeyFrames classes). I've trying uninstalling and reinstalling the javaFx plugin but still doesn't find it.

I need it for a program like this:
----------------------------------------------------
var somevar....
function blabla()....

Frame{
operation update(){
...
}

--------------------------------------------------
The update operation update the variables using some of the previously defined functions.
I need some way to do this operation each second (for example) without blocking the GUI so the user still can interact

Any suggestion? Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bigalvarado
Offline
Joined: 2008-07-29

Well, I managed to resolve the problem. (I forgot to include the package name over the imports)

Thanks to everyone! :D

bigalvarado
Offline
Joined: 2008-07-29

Okay. I got NetBeans 6.1 and had the JavaFx installed, but when trying to run your
example program (and some others), this exception appears:

java.lang.NoClassDefFoundError: prueba/Main
Caused by: java.lang.ClassNotFoundException: prueba.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: prueba.Main. Program will exit.

I've read something about this being a problem of the JDK 6. I've both JDK 5 and 6 but in NetBeans 6.1 javaFX compiler needs JDK 6.

alexsch
Offline
Joined: 2007-07-12

Did you try to install the latest JavaFX Script plugin from http://deadlock.netbeans.org/hudson/job/JavaFX_NB_daily ?

It works with NetBeans 6.1.

The following example should work there:

[code]
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;

import java.lang.System;

function update () {
System.out.println("Update");
}

var timeline = Timeline {
repeatCount: Timeline.INDEFINITE
keyFrames : [
KeyFrame {
time : 1s
action: function() {
update();
}
}
]
}

timeline.start();
[/code]

cdouglass
Offline
Joined: 2005-08-24

JavaFX is very much a moving target at the moment.

See this page http://openjfx.java.sun.com/ for milestone and dev builds. I haven't played with animation, but you probably need one of these builds.

Chas Douglass