Writing Custom UI Controls
Christian Schudt
christian.schudt at gmx.de
Mon Jul 16 09:09:47 PDT 2012
Hi,
I wondered about that topic, too.
I do it that way, that I only use Control and Skin<C> (public API)
I put all the behavior in the class which implements Skin<C>.
Sometimes, I also derive from layout containers or other controls.
I think this depends on what you want to achieve and what base implementation helps you most.
If you want to layout stuff, use layout containers. If you want to extend some functionality (e.g. I added maxLength to the TextField), derive from an existing control.
Otherwise derive from Control.
Just the use of the BehaviorBase is questionable.
Regards
Christian
Am 16.07.2012 um 14:33 schrieb Elisa Deaibess:
> Hi,
>
> We are writing a new application using JavaFX 2.x. Our application needs
> some custom controls such as a searchfield, listoptions, ribbon,
> breadcrumbs, etc...
>
> We decided to write common reusable controls; To do that we have 2 ways:
>
> 1. Make our controls extends Control and create new skin
> 2. Extend some layout container or other control
>
>
> Which one do you recommend?
> Is it safe that our custom controls extends Control and to use the
> skin/behavior? Or com.sun.javafx.scene.control.skin.SkinBase is a private
> class and risk to be removed in the next releases
>
> In JavaFXPro book I read the following:
>
> *Caution *In the discussion that follows, we mention Java classes in
> packages whose names begin with com.sun.
> These classes are implementation details of the JavaFX runtime system and
> are not meant to be used in normal JavaFX applications.
> And they may change in future releases of JavaFX.
>
> Could you please advise?
>
> Regards,
> Elisa
More information about the openjfx-dev
mailing list