SkinBehaviour and JavaFX 8?

Jonathan Giles jonathan.giles at
Fri Feb 1 01:17:12 PST 2013


To start with I need to be clear that in JavaFX 2.x SkinBase and 
BehaviorBase were private APIs (that is, they both resided in com.sun.* 
packages). This means that they shouldn't have been used by third 
parties. Instead, third parties should have been building from the Skin 
interface. Of course, most people used SkinBase, and whenever I went to 
conferences I would promise people that the day of reckoning would come 
when I broke them. Well, that day is fast approaching.... :-)

JavaFX 8.0 brings SkinBase to public API, but we are not prepared to 
bring BehaviorBase along with it just yet. This is because the concept 
of a behavior needs to be fleshed out further in a number of directions, 

  * Making behaviors less opaque (i.e. more easily accessible to 
developers via the control - in other words bringing the concepts of 
actions and input/action maps to JavaFX),
  * Improving toolability of behaviors / actions (so tools such as Scene 
Builder can know that a TextField offers cut/copy/paste, for example),
  * Making it possible for developers to override and provide custom 
input mappings / actions more easily.

It's late here and I'm sure there were other reasons for wanting more 
bake time on behaviors, but this was the general gist of things.

What this means is that SkinBase in JavaFX 8.0 has no notion whatsoever 
of a behavior for specifying key/mouse input event handling. In other 
words, your code will need to manually handle keyboard and mouse 
interactions. In the future I am sure we will get to this point, but we 
are not there yet.

Finally, don't look at how we in the UI controls team do it. I wouldn't 
want you to see the (very private!!!) BehaviorSkinBase class that is 
essentially a drop-in replacement for the old SkinBase class. Of course, 
if you did see this I'm sure you wouldn't use it as it is private API 
that I (once again) promise to change in the future when we resolve the 
behavior discussion.

-- Jonathan

On 1/02/2013 9:38 p.m., Tobias Bley wrote:
> Hi,
> there seams to be some changes from JavaFX 2 to JavaFX8 concerning SkinBase and SkinBehavior. In JFX2 you could call the constructor from SkinBase with a component (e.g. slider) and a skin behavior. In JFX8 it's not possible any more, I could only call the constructor of SkinBase with the control, not with the SkinBehavior.
> So my question is: How do I have to specify the SkinBehavior in JavaFX8?
> Best regards,
> Tobi

More information about the openjfx-dev mailing list