| Author |
Extending javafx.animation.KeyValue public-init override problem
|
Fabricio Sanchez
Ranch Hand
Joined: Mar 11, 2003
Posts: 33
|
|
Hi there,
I want to extend class javafx.animation.KeyValue so that I can attach extra information to a KeyValue animation (inside a Timeline KeyFrame).
The problem I have is that the only way I've found of instantiating a KeyValue for a KeyFrame is:
So how can I initialise my subclass to something meaningful using the syntax above?
Solution Attempt 1:
I've also tried to generate an inner KeyValue, which I think works, however, I can't tie it in to the superclass public-init variables.
Solution Attempt 2:
For the above to work, I want to override the following variables that exist in javafx.animation.KeyValue
Any ideas?
Thank you,
Fabricio
|
 |
Jim Clarke
author
Ranch Hand
Joined: Jun 15, 2009
Posts: 49
|
|
This is a bug, (JFXC-3979). You cannot override a public-init variable. I don't know when it will be fixed, but the work around is to initialize the variables in the object Literal for the sub-class.
MyKeyValue {
interpolate: Interpolater.EASE_BOTH
}
|
 |
Fabricio Sanchez
Ranch Hand
Joined: Mar 11, 2003
Posts: 33
|
|
Thank you Jim,
That worked. My extension class is just a dummy class now as I have to create and initialise everything outside it and then just set the initialisation values as you suggested.
Double the work until they fix this bug, but as long as it works.
Here's a description of what I'm doing for anyone who might want to try it:
|
 |
 |
|
|
subject: Extending javafx.animation.KeyValue public-init override problem
|
|
|