SkinBehaviour and JavaFX 8?

Jonathan Giles jonathan.giles at
Sun Mar 24 23:18:03 PDT 2013

I'm on my phone so I'll keep this brief.

1) Replace with layoutChildren(x,y,w,h) in the skin class.

2) Behavior continues to be private API in JavaFX 8. I note that there have been some suggestions in the JFXtras mailing list and in my email below. Those continue to be the best options, along with folding Behavior back into your skin class.
-- Jonathan
Sent from a touch device. Please excuse my brevity.

Tom Eugelink <tbee at> wrote:

>Yesterday I've ported JFXtras to J(FX)8 and basically are two issues
>1. Where do I go with the code that is in the @Override layoutChildren
>method in skin classes?
>Currently there are two types of skin classes in JFXtras; one which
>uses properties plus binding and one that overrides layoutChilderen.
>The first approach is actually not really encouraged in JavaFX because
>it may be slower (may take more than one cycle to render), but they
>turn out to be very easy to migrate. The other approach (override) does
>not compile anymore. Since I chose to develop propety based, I'm not
>sure how to best fix the other controls. Should I override the
>control's layoutChildren en forward it to the skin's?
>2. Behavior classes
>99% of the behavior classes are empty but I have one control that
>actually has some sensible code in it. Since the email below is a bit
>older already; are there any insights where to go with this code? Or
>can I clean out the behavior classes all together and simply move it
>into the skin class?
>On 2013-02-01 10:17, Jonathan Giles wrote:
>> Tobi,
>> 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, including:
>>  * 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
>>  * 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
>>> Best regards,
>>> Tobi

More information about the openjfx-dev mailing list