Skip to main content

fx package vs sg

3 replies [Last post]
billg
Offline
Joined: 2008-02-03
Points: 0

Hello Everyone,

This maybe a dumb question but I am going to ask it anyway. What is the reason for the fx package? From what I can tell they are all wrappers of their corresponding SG counterpart, with the added functionality that they get from extending the FXNode (which wraps in some transform and clipping functionality).

The rule of thumb I have been using when deciding which class to use, has been if I can benefit from the functionality that FXNode provides. If I can then I use the fx class if not then I use the SG class. Does anyone else have any more insight into this? I would like to make sure that I am using the right classes to best take advantage of future functionality added to Scene Graph.

Thanks for any feedback,
Bill

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Hans Muller

The FX Script graphics/UI library uses (just) fx.FXNode because it
provides intrinsic efficient support for transforms. You may find that
it's a little simpler to use FXNode, and the other FXFoo wrappers, in
Java applications for the same reason.

- Hans

scenario@javadesktop.org wrote:
> Hello Everyone,
>
> This maybe a dumb question but I am going to ask it anyway. What is the reason for the fx package? From what I can tell they are all wrappers of their corresponding SG counterpart, with the added functionality that they get from extending the FXNode (which wraps in some transform and clipping functionality).
>
> The rule of thumb I have been using when deciding which class to use, has been if I can benefit from the functionality that FXNode provides. If I can then I use the fx class if not then I use the SG class. Does anyone else have any more insight into this? I would like to make sure that I am using the right classes to best take advantage of future functionality added to Scene Graph.
>
> Thanks for any feedback,
> Bill
> [Message sent by forum member 'billg' (billg)]
>
> http://forums.java.net/jive/thread.jspa?messageID=269401
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
> For additional commands, e-mail: dev-help@scenegraph.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
For additional commands, e-mail: dev-help@scenegraph.dev.java.net

Chris Campbell

FXNode and its subclasses simplify lots of things, transforms being just
one of them. It makes it possible to set properties on a node without
lots of awkward (and error-prone) chaining. Compare:

SGShape shape = new SGShape();
shape.setShape(circle);
// oh, now I need an Effect, so add another node to the chain
SGEffect effect = new SGEffect();
effect.setEffect(blur);
effect.setChild(shape);

to:

FXShape shape = new FXShape();
shape.setShape(circle);
shape.setEffect(blur);

The FXNode classes have been optimized so that they only allocate the
extra nodes in the internal chain on an as-needed basis, so there isn't
a major footprint impact from using these classes.

Personally, I'd prefer to see the FX classes be the primary point of
entry for developers using Scenario. (It would help if the SG vs FX
naming was less awkward.)

Thanks,
Chris

Hans Muller wrote:
>
> The FX Script graphics/UI library uses (just) fx.FXNode because it
> provides intrinsic efficient support for transforms. You may find that
> it's a little simpler to use FXNode, and the other FXFoo wrappers, in
> Java applications for the same reason.
>
> - Hans
>
>
> scenario@javadesktop.org wrote:
>> Hello Everyone,
>>
>> This maybe a dumb question but I am going to ask it anyway. What is
>> the reason for the fx package? From what I can tell they are all
>> wrappers of their corresponding SG counterpart, with the added
>> functionality that they get from extending the FXNode (which wraps in
>> some transform and clipping functionality).
>>
>> The rule of thumb I have been using when deciding which class to use,
>> has been if I can benefit from the functionality that FXNode provides.
>> If I can then I use the fx class if not then I use the SG class. Does
>> anyone else have any more insight into this? I would like to make sure
>> that I am using the right classes to best take advantage of future
>> functionality added to Scene Graph.
>>
>> Thanks for any feedback,
>> Bill
>> [Message sent by forum member 'billg' (billg)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=269401
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
>> For additional commands, e-mail: dev-help@scenegraph.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
> For additional commands, e-mail: dev-help@scenegraph.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@scenegraph.dev.java.net
For additional commands, e-mail: dev-help@scenegraph.dev.java.net

billg
Offline
Joined: 2008-02-03
Points: 0

Hi Guys,

Thanks for your feedback; it is clearer the benefits of going with the FX.. classes.

I do have a somewhat related question (about chaining effects for either FX or SG nodes) which I am going to post under a different subject. Please reply if you get a chance.

Thanks,
Bill