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 JavaFX and the fly likes Extending javafx.animation.KeyValue public-init override problem 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 » Java » JavaFX
Bookmark "Extending javafx.animation.KeyValue public-init override problem" Watch "Extending javafx.animation.KeyValue public-init override problem" New topic
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:
 
Consider Paul's rocket mass heater.
 
subject: Extending javafx.animation.KeyValue public-init override problem
 
Similar Threads
My LinkedList Iterator - Can't print first element - No use of Java API
JQ+ question
Insider's Guide to Mixing Swing and JavaFX
do while help
can static method overridden?