New skinning in FX8 – where do the style classes go
Werner Lehmann
lehmann at media-interactive.de
Tue Jun 10 17:59:00 UTC 2014
Hi Randahl,
see this wiki page...
https://wiki.openjdk.java.net/display/OpenJFX/UI+Controls+Architecture
and below:
On 10.06.2014 19:18, Randahl Fink Isaksen wrote:
> Object ◀︎—— SkinBase ◀︎—— MySkin ——> MySkinControl
The new SkinBase is returning a modifiable version of the control's
children. The FX2 way was actually more convoluted with
behind-the-scenes copying of properties but I think that is covered on
the wiki.
> One problem is, whenever I have a control MyControl using a skin
> class MySkin I used to be able to change the style class of MyControl
> and those changes would automatically be reflected by MySkin. Now
> with FX8 when I change the style class of MyControl, nothing
> happens.
This works for me. Maybe your css selectors need to be adjusted. After
all the node hierarchy no longer has an extra skin node.
> Am I supposed to bind the styleClass property of my MySkinControl
> instance to the styleClass of my MyControl instance?
Certainly not.
In my opinion the control creation process is quite simple now. Create a
new control class, set the style class, and provide the default skin by
overriding createDefaultSkin(). Here you return an instance of your skin
which extends SkinBase. Which is where you observe the control
properties as usual. And use SkinBase.getChildren to add skin content.
Werner
More information about the openjfx-dev
mailing list