• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Extending javafx.animation.KeyValue public-init override problem

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
author
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic